running app as different user

James Gray james.gray at dot.com.au
Wed May 2 12:23:38 UTC 2007


Paul Kaplan wrote:
> I know how to run applications w/ root privileges using sudo, but how can I 
> run an application as a different normal user?
> Paul
>   
How about:

sudo -u userid /path/to/command

"man sudo" is your friend :)

Alternatively you can use "su".  For instance to start a login shell as 
user "foo" you could use:
1. su -l foo    (enter foo's password when prompted)
2. sudo su -l foo   (enter YOUR password when prompted)

Or you can skip the login shell, and simply load foo's environment:
1. su foo -    (enter foo's password)
2. sudo su foo -  (enter YOUR password)

See the difference?  If not, hit those man pages - it will all start to 
make sense

All depends on what you're trying to achieve :P

Cheers,

James




More information about the ubuntu-users mailing list