Enable root login via ssh not working?
I want to enable root login via ssh. So I add the ligne 'PermitRootLogin yes' to ssh config file '/etc/ssh/sshd_config' :
Port 22
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
UsePrivilegeSeparation yes
KeyRegenerationInterval 3600
ServerKeyBits 1024
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
RhostsRSAAuthentication
PermitEmptyPasswords no
ChallengeResponseAuthentication no
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
But the access is denied.
thanks in advance
2 Answers
It could be a couple of things:
1)If you are trying to log in using a password you will need to add:
PasswordAuthentication yesin the config file. (Should only use this method for setting up ssh keys initially)
2)You have not properly set up your SSH keys.
3)The ssh port is being blocked by the firewall.
5In ubuntu 20.04 root has no default password causing SSH connection to fail with "Permission denied, please try again".
To solve this you must set a password. Run
sudo passwd
and enter your password twice.
1