You are not logged in.

#1 2006-10-10 13:09:22

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

[solved]Starting a program as 'nobody'

I created a /etc/rc.d/ file for starting and stopping a http server. But I want start it as nobody instead of root. I am trying to use 'su' but I can't make it work... how should I?

Offline

#2 2006-10-11 06:13:58

firedance
Member
From: Stockholm, Sweden
Registered: 2005-04-18
Posts: 131

Re: [solved]Starting a program as 'nobody'

ezzetabi wrote:

I created a /etc/rc.d/ file for starting and stopping a http server. But I want start it as nobody instead of root. I am trying to use 'su' but I can't make it work... how should I?

I think most http servers have a User and Group setting in their config, so when run as root it will change to that user and group.

Offline

#3 2006-10-11 07:17:13

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

Re: [solved]Starting a program as 'nobody'

Well, maybe... But the point is more general... it is not only about the http server.

How can I start any program as nobody?

Offline

#4 2006-10-11 14:03:04

Eliatamby
Member
Registered: 2005-05-06
Posts: 80

Re: [solved]Starting a program as 'nobody'

isn't it just

 su user /path/to/bin

Offline

#5 2006-10-11 14:19:18

firedance
Member
From: Stockholm, Sweden
Registered: 2005-04-18
Posts: 131

Re: [solved]Starting a program as 'nobody'

Putting the executable as setuid and changing the owner to nobody would work i guess.

Offline

#6 2006-10-11 21:10:58

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

Re: [solved]Starting a program as 'nobody'

I am not sure what firedance meant, but I found
su nobody -s'/full/path' works...
It seems su does not check if the shell is in /etc/shell when executed as root.

Offline

#7 2006-10-11 22:14:23

Eliatamby
Member
Registered: 2005-05-06
Posts: 80

Re: [solved]Starting a program as 'nobody'

basically if you set the owner of /bin/someapp to nobody, then set the setuid bit of the /bin/someapp, ( think it's chmod +s) then everytime /bin/someapp is run it's run as that owner.  Manyt people do this to allow shutdown as regular users -- set the setuid bit on /sbin/halt so that it always runs as the root user

Offline

Board footer

Powered by FluxBB