LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-29-2009, 07:58 PM   #1
carlosjf
LQ Newbie
 
Registered: Jan 2009
Distribution: Fedora 8
Posts: 5

Rep: Reputation: 0
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
 
Old 01-29-2009, 08:03 PM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,264

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
These work:
Code:
su -c <cmd> <user>
Code:
sudo -u <user> <cmd>
 
Old 01-29-2009, 08:10 PM   #3
carlosjf
LQ Newbie
 
Registered: Jan 2009
Distribution: Fedora 8
Posts: 5

Original Poster
Rep: Reputation: 0
That worked..
Thanks chrism01

-Carlos
 
Old 04-01-2011, 09:14 AM   #4
digilifellc
LQ Newbie
 
Registered: Mar 2010
Location: Newark, NJ
Distribution: Ubuntu, LinuxMint
Posts: 6

Rep: Reputation: 0
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?
 
Old 04-01-2011, 09:46 AM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,008

Rep: Reputation: 367Reputation: 367Reputation: 367Reputation: 367
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"
 
Old 04-01-2011, 06:41 PM   #6
digilifellc
LQ Newbie
 
Registered: Mar 2010
Location: Newark, NJ
Distribution: Ubuntu, LinuxMint
Posts: 6

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why can't i execute shutdown as a normal user? cryincold Debian 14 09-02-2007 03:38 PM
enable a command that requires root access for a normal user marsguy Linux - General 2 10-08-2006 09:43 AM
how to run root command having normal user permission ravi.patil Linux - Newbie 7 05-21-2006 02:21 PM
boot script execute command as non-root user wampfler Linux - Security 7 09-24-2004 04:56 AM
normal user can't execute files in cd..? doublefailure Linux - Hardware 0 09-11-2002 01:04 AM


All times are GMT -5. The time now is 08:43 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration