0

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?

1 Answer 1

1

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.