How to reset default ssh password in Ubuntu?

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

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

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like