Thursday, July 13, 2017

unable to ssh as root without password

sed -i -e 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

sed -i -e 's/#PermitEmptyPasswords no/PermitEmptyPasswords yes/' /etc/ssh/sshd_config

systemctl restart sshd

1. change the "#PermitRootLogin prohibit-password" to "PermitRootLogin yes"

- This means changing the default behavior of not allowing the Root login (only with)  -> allowing the root login

more info

 * The default for the sshd_config(5) PermitRootLogin option has
   changed from "yes" to "prohibit-password".

 * PermitRootLogin=without-password/prohibit-password now bans all
   interactive authentication methods, allowing only public-key,
   hostbased and GSSAPI authentication (previously it permitted
   keyboard-interactive and password-less authentication if those
   were enabled).

With that configuration you cannot login in as root with a password. Use keys instead.

2. change "#PermitEmptyPasswords no" to "PermitEmptyPasswords yes" as in your case root does not have any password

3. restart the sshd daemon 

No comments: