Koozali.org: home of the SME Server

Legacy Forums => General Discussion (Legacy) => Topic started by: EB on July 18, 2001, 08:58:59 PM

Title: Execute a file as a different user
Post by: EB on July 18, 2001, 08:58:59 PM
Hi,

I know this may be a stupid question, but does anyone know how to execute a program/file as a different user than you are logged in as. For example: I am logged in as root, but want to execute ( ./someprogram ) as user joe.

Thanks,

EB
Title: Re: Execute a file as a different user
Post by: Ed on July 18, 2001, 11:49:33 PM
Well you can "su joe" which effectively changes who you logged in as to joe.  Run the program.  'exit' to go back to root.  This only works as root without a password.  If you are not root, then you need joe's password for "su joe" to work.

The other option is to use the permission to run the program as a "setuid" program.  Do a google search on setuid.

ed
Title: Re: Execute a file as a different user
Post by: Scott Smith on July 18, 2001, 11:54:48 PM
Assuming you're using e-smith 4.1.x ...

man sudo

Scott
Title: Re: Execute a file as a different user
Post by: EB on July 19, 2001, 02:07:47 AM
Thanks,

sudo worked

EB