LinuxQuestions.org
Register a domain and help support LQ
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 08-30-2012, 07:44 AM   #1
figure20012
Member
 
Registered: Apr 2012
Posts: 75

Rep: Reputation: Disabled
run command after sudo -s


can i run the command
sudo -s ls
to list the files
or any command
sudo -s commmand
please help
 
Old 08-30-2012, 09:00 AM   #2
gillbertiddio
Member
 
Registered: Sep 2009
Posts: 33

Rep: Reputation: 6
The "-s" option to "sudo" begins a root session (exit via the "exit" command) so the commands issued following the input of "sudo -s" would be issued as root. For any information on any command you wish to know more about please use the "man" command -
Code:
man sudo
 
1 members found this post helpful.
Old 08-30-2012, 09:59 AM   #3
wigry
Member
 
Registered: Jul 2004
Distribution: slackware
Posts: 222

Rep: Reputation: 52
typical command in one of my corporate servers I administer:

Code:
sudo -u liferay -s /etc/init.d/jetty6 restart
or even more advanced, as I do not have permission to sudo as root, I have to sudo to different user who in turn has permission to sudo as root:

Code:
sudo -u liferay -s sudo /etc/init.d/httpd restart
 
1 members found this post helpful.
Old 08-30-2012, 08:37 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
@gillbertiddio; that doesn't seem to be what it says here http://linux.die.net/man/8/sudo
Quote:
-s [command]
The -s (shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified in passwd(5). If a command is specified, it is passed to the shell for execution. Otherwise, an interactive shell is executed.
 
1 members found this post helpful.
  


Reply

Tags
sudo


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
run a user-defined command without sudo anurupr Programming 13 03-19-2013 12:28 PM
sudo cd /root gives 'sudo: cd: command not found'. stf92 Linux - Newbie 4 03-03-2012 10:05 AM
(Sudo) command can't run by sudo rahilmaknojia Linux - Server 8 06-25-2010 10:30 AM
gnome launcher won't run a sudo command directly or via a script gnreeke Linux - Desktop 1 06-23-2009 11:44 AM
can't run app w/ sudo command fatblueduck Linux - Software 2 09-30-2005 08:39 PM


All times are GMT -5. The time now is 05:35 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration