Thread View: apana.lists.os.linux.c-programming
2 messages
2 total messages
Started by Nathan Bird
Tue, 26 Sep 2000 00:00
chown, getuid and getgid operations
Author: Nathan Bird
Date: Tue, 26 Sep 2000 00:00
Date: Tue, 26 Sep 2000 00:00
22 lines
1877 bytes
1877 bytes
Hi, I am trying to write a web page script in C which is to take a username and password from a HTML form and process it in the C code. The code then has to create a public_html directory under the users home directory ( specified by the username ) and then creates an index.html file. The part I am getting stuck on is I have to set the directory and files to the correct user and groups. ( ie the username entered in the HTML form ), I know the command setuid, setgid and getuid, and getgid exist however they only allow you to set it to the value of the person calling the process which is NOBODY. As nobody is the value always used when a process is called from a Web Page. Does anyone know how to take the value in the string/char array "username" and run the chown() command and pass it the "username" rather then the id of the process caller. Thanks in advance Nathan nathanb@hunterlink.net.au
Re: chown, getuid and getgid operations
Author: Emmanuel SARACCO
Date: Tue, 26 Sep 2000 00:00
Date: Tue, 26 Sep 2000 00:00
37 lines
2184 bytes
2184 bytes
Hi, Your C program must run as root with suid bit set (make a safe code!). Bye Nathan Bird wrote: > > Hi, > > I am trying to write a web page script in C which is to take a username and > password from a HTML form and process it in the C code. > The code then has to create a public_html directory under the users home > directory ( specified by the username ) and then creates an index.html file. > > The part I am getting stuck on is I have to set the directory and files to > the correct user and groups. ( ie the username entered in the HTML form ), I > know the command setuid, setgid and getuid, and getgid exist however they > only allow you to set it to the value of the person calling the process > which is NOBODY. As nobody is the value always used when a process is called > from a Web Page. > > Does anyone know how to take the value in the string/char array "username" > and run the chown() command and pass it the "username" rather then the id of > the process caller. > > Thanks in advance > > Nathan > nathanb@hunterlink.net.au -- zZz------------o-O-o---------o-O-o------------zZz .oOo. If windows is the answer .oOo. Then you don't understand the question zZz------------o-O-o---------o-O-o------------zZz
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads