LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 06: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, 08: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, 08:59 AM   #3
wigry
Member
 
Registered: Jul 2004
Distribution: slackware
Posts: 225

Rep: Reputation: 53
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, 07:37 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
@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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:15 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
Open Source Consulting | Domain Registration