9

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

2 Answers 2

7

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.

1
  • 1
    +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, 2012 at 23:10
11

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .