Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using ubuntu 10.04.

I notice that after I run "sudo -s" in terminal, the prompt changed from




seems it changed to root privilege.

But when I check the documentation of "sudo" command here, it explains another story of "sudo -s", can anyone explain to me what is "sudo -s" doing exactly?

share|improve this question

migrated from stackoverflow.com Jul 6 '11 at 7:37

This question came from our site for professional and enthusiast programmers.

You should ask this over at askubuntu.com –  Ocaso Protal Jul 6 '11 at 7:26
Why askubuntu.com? sudo is hardly Ubuntu-specific... –  Dave Sherohman Jul 6 '11 at 8:21
possible duplicate of Difference between comands "su -s" and "sudo -s" –  Linker3000 Jul 6 '11 at 8:26

5 Answers 5

sudo -s let you run a command for which you're pre-authorized [see /etc/sudoers], possibly by asking you to confirm your current ID.

share|improve this answer

It sounds like it is creating another instance of the shell on top of the current shell, but with root privileges. I'll bet that after you do sudo -s if you type exit, you will go back to the original shell.

share|improve this answer

The two aren't really inconsistent - the sudo command always changes user, either to root, or to the user you specify with the -u switch. All the -s does is provide a shortcut for starting a shell as that user. It is really equivalent to:

sudo $SHELL

except that it will likely fallback to /bin/sh or something if SHELL is not set.

share|improve this answer

Have a look at this post from superuser:


By the way, your post should be moved to superuser (or askubuntu as said in comments)!

share|improve this answer

RTFM everything is in there.

sudo allows a permitted user to execute a command as the superuser or another user, as specified in the sudoers file.

-s Shell, runs the shell specified by the SHELL environment variable if it is set or the shell as specified in passwd(5).

More seriously, the sudo -s run a shell environment variable. Since you didn't add any variable it run as specified in passwd, and so connect you as root.

share|improve this answer
It is not obvious from the manual that if you don't provide a user, it defaults to root. You would have to read the description for -u option to learn that. But for someone who is not familiar with sudo, they wouldn't know to look at -u. –  wisbucky Mar 18 at 23:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.