What is the difference between the following:

I have 2 accounts in my OS, baron and root

I login with baron account, then run the command sudo -s

baron@linux:~@ sudo -s 
[sudo] password for baron:

I logout, then login with root account and terminal shows:


So why the terminal is showing the same when I login with different accounts?

  • To clarify: are you asking why the prompts for user root are different depending on how you log in? – dhag Apr 28 '15 at 18:00

Your prompt shows the user, hostname & current dir

user@hostname:/current/dir $

When you execute the sudo command as a normal user (baron in your case), you're giving the system an order to make "something" as root or with root privileges. See root definition

With the -s option, you're giving the order to become root user with an interactive shell environment since there's no command specified

--From man sudo

-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 the password database.  If a command is specified, it is passed to the shell for execution
               via the shell's -c option.  If no command is specified, an interactive shell is executed.

Then, when you login as root, the main account will be root, so you don't need to execute sudo at all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.