Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im accessing my sever over SSH, with a normal user account. At some point i need to log as root, i have the root and password credentials, but when I invoke the sudo - command the prompt ask me for a root password for the current logged user user, how can i change the username back to root?

share|improve this question
up vote 1 down vote accepted

I think you're confusing two commands: sudo and su.

sudo allows you to run a single command as another user.

su allows you to switch to another user.

So, when you've signed in as your normal user, if you want to issue a single command as root, you should use sudo:

$ sudo <command>

This will ask for your password.

Likewise, if you want to issue a command as user jimbob:

$ sudo -u jimbob <command>

This will also ask for your password.

If you want to switch to the root user:

$ su -

This will ask for the root password.

It is highly recommended that you always use sudo to run privileged commands, though, instead of switching to another user.

share|improve this answer

Your Answer


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

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