LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   run command after sudo -s (https://www.linuxquestions.org/questions/linux-newbie-8/run-command-after-sudo-s-4175424752/)

figure20012 08-30-2012 06:44 AM

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

gillbertiddio 08-30-2012 08:00 AM

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

wigry 08-30-2012 08:59 AM

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

chrism01 08-30-2012 07:37 PM

@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.


All times are GMT -5. The time now is 02:12 AM.