Super User is a question and answer site for computer enthusiasts and power users. 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

When I trying to connect via ssh to localhost as root, ssh don't accept my current password. How can I reset ssh password?

share|improve this question
up vote 5 down vote accepted

By default, ssh disables root login: you are expected to log in as user and then use su or sudo to become root.

This is an extra security step: if an invader knows or discovers the user password, he can ssh the machine but not become root.

That said, if you want to disable this behaviour, edit /etc/ssh/sshd_config and add the line PermitRootLogin Yes.

share|improve this answer
+1. Although I can't remember what the standard Ubuntu policy on this is, and I don't have an Ubuntu installation handy at the moment. – Alexios Mar 25 '12 at 23:10

On the machine you want to log into, as a non-root user, type:

sudo passwd root

And you'll be prompted for a new password (after you type your own non-root password)

One little note: there's no such thing as an ‘ssh password’. SSH (unless you set it up in very specific ways, all of which are fairly complex and totally beyond the scope of the question), authenticates against the standard Unix user database (/etc/passwd, /etc/shadow, /etc/group). You'll be changing root's own password.

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.