1

Bit of an odd problem. I've got a server I can SSH into as one of two logins: root or erik. Once I've logged in as erik I've tried to switch to the root user:

# sudo su - root
Password:

And entered the password. After several failures I thought I might have forgotten. So I SSH'd in as root, and changed the root password:

# passwd

Now back to the other shell (erik) and attempt to run sudo su - root and again, it won't accept the just changed password. Any ideas?

1 Answer 1

4

"sudo su" is redundant. Use just "su - root".

When using sudo if the user (erik) is in the sudoers group (usually "sudo" or "wheel") then you are expected to provide erik's password at the password prompt and then "su - root" is run as root so it will just spawn another instance of the shell without asking for password.

On the other hand if you run just "su - root", then you will be prompted for root's password.

2
  • thanks; apparently my user is not in the sudoers file
    – erik
    Jun 24, 2012 at 23:41
  • @erik if this answered your question, click the check mark to the left of the question to accept it as the correct answer. It helps to quickly show future visitors what the answer is as well as keeping this question from floating to the top page periodically. It might be worthwhile to read the faq, this site is quite a bit different than a forum.
    – MDMarra
    Jun 25, 2012 at 0:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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