Koozali.org: home of the SME Server

Execute a file as a different user

EB

Execute a file as a different user
« 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

Ed

Re: Execute a file as a different user
« Reply #1 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

Scott Smith

Re: Execute a file as a different user
« Reply #2 on: July 18, 2001, 11:54:48 PM »
Assuming you're using e-smith 4.1.x ...

man sudo

Scott

EB

Re: Execute a file as a different user
« Reply #3 on: July 19, 2001, 02:07:47 AM »
Thanks,

sudo worked

EB