Page 1 of 1

login as root but run script as guest

Posted: 14 Dec 2015, 23:32
by francois
I am working in root mode. I would like to create a script to start chromium as user guest, from one command line if possible without having to issue the password for guest. Is this possible?

Re: starting package with a script for user guest

Posted: 15 Dec 2015, 01:40
by brokenman

Code: Select all

su - guest -c chromium

Re: starting package with a script for user guest

Posted: 15 Dec 2015, 03:53
by aus9
su - guest -c chromium
I am not sure if that will work but in a test of mtpaint I changed to root and then ran

Code: Select all

su -c guest mtpaint 
su: user mtpaint does not exist
but this does work

Code: Select all

su -c mtpaint guest

so as I don't have chromium installed I would suggest

Code: Select all

su -c chromium guest

Re: starting package with a script for user guest

Posted: 15 Dec 2015, 04:07
by francois
aus9, you have the winning combination.

Thanks to both of you.

Re: starting package with a script for user guest

Posted: 15 Dec 2015, 12:37
by brokenman
Sorry mixed the order. The correct aproach would be:

Code: Select all

su guest - -c mtpaint
su guest -
Starts a login shell for guest with guest environment.

-c command
Runs a command for su