🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: apana.lists.os.linux.c-programming
Article #5

Re: chown, getuid and getgid operations

#5
From: Emmanuel SARACCO
Date: Tue, 26 Sep 2000 00:00
37 lines
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
Technical Details
Message-ID: <39D06FF1.EF364E7C@noos.fr>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <39d02c9f$1@news.hunterlink.net.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fdf5c,2e5e1279a45cbb62
X-Google-Attributes: gidfdf5c,public
X-Google-Thread: 1116e3,2e5e1279a45cbb62
X-Google-Attributes: gid1116e3,public
X-Google-Thread: 10aedf,2e5e1279a45cbb62
X-Google-Attributes: gid10aedf,public
From: Emmanuel SARACCO <esaracco@noos.fr>
Subject: Re: chown, getuid and getgid operations
Date: 2000/09/26
Message-ID: <39D06FF1.EF364E7C@noos.fr>
X-Deja-AN: 674196187
Content-Transfer-Encoding: 7bit
References: <39d02c9f$1@news.hunterlink.net.au>
X-Accept-Language: fr, en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@isdnet.net
X-Trace: news2.isdnet.net 969953799 14236 195.132.226.21 (26 Sep 2000 07:36:39 GMT)
Mime-Version: 1.0
Reply-To: esaracco@noos.fr
NNTP-Posting-Date: 26 Sep 2000 07:36:39 GMT
Newsgroups: apana.lists.os.linux.c-programming,linux.dev.c-programming,linux.dev.newbie