Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I have learned more through this forum than I did on a two day course. Thanks to everyone for their help and other postings that I have found useful..."

Geography

Where in the world do Tek-Tips members come from?

Linux/Apache/C Language/System call - SetUserId problem

Glomet (Programmer)
21 Mar 06 6:16
Hello.

Years ago I used to run some system-dependent procedures via a CGI interface, simply running them inside a system call. But with more recent systems it doesn't work the same way: now there are user concerning problems (I think it depends on Apache updates occurred in the last years). The same identical procedures that I used to run on older system doesn't work properly on newer. Do you have any idea?

IE:

#include <stdio.h>
#include <stdlib.h>
main (void) {
FILE *fp;
char st [16];
  printf ("Content-type: text/html\n\n");
  system ("echo \"Hello\" > /tmp/appo/cgiOutputFile");
  fp = fopen ("/tmp/appo/cgiOutputFile", "r");
  if (fp) {
    fscanf (fp, "%s", st);
    fclose (fp);
    printf ("%s", st);
  }
  else
    printf ("Error");
}


The problem is about the user that is used to run such a call. If I wanted a particular user to be used as, I simply had to "chmod u+s" the CGI script, and it was run just like it was run from the user that owned the script.
But now it doesn't work anymore: any file directly created from behind the CGI script, after having chmoded +s the script, it is owned by the same user as that of the CGI script (as in the past smile), but any file indirectly created from the outside system called command, they are owned by nobody:users on a system or apache:apache on another system (this last is a Fedora Core 1), and not as "user" sad.

Have I to reconfigure/recompile apache? Or do you have any other idea?

Please, help.

Regards
-- Umberto

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close