LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Root execute command as a normal user (https://www.linuxquestions.org/questions/linux-newbie-8/root-execute-command-as-a-normal-user-700916/)

carlosjf 01-29-2009 07:58 PM

Root execute command as a normal user
 
Normal users can execute as command as root using sudo.
My question is, how can root execute something as a normal user.
In the following example, if I execute as root "sudo -u user whoami"
the program whoami replies with root. I'm guessing there must be another way..

Thanks in advance..

-Carlos

chrism01 01-29-2009 08:03 PM

These work:
Code:

su -c <cmd> <user>
Code:

sudo -u <user> <cmd>

carlosjf 01-29-2009 08:10 PM

That worked..
Thanks chrism01

-Carlos

digilifellc 04-01-2011 09:14 AM

Run command in rc.local as user
 
I have a similar situation. Running Arch, I need to run a command in rc.local as the local user. How do I do this?

tredegar 04-01-2011 09:46 AM

Try something like this
Code:

# Start a vnc server as the user install
su - install -c "cd /home/install && vncserver -geometry 1024x768 -depth 24 :1"


digilifellc 04-01-2011 06:41 PM

Thanks for the help, but I found the answer myself: Autostart for Openbox


All times are GMT -5. The time now is 03:04 PM.