Cannot ssh as root user

By | 28th December 2015

Debian disables root ssh access by default due to security risk. In general, it is not a good idea to enable root ssh but if you must, edit /etc/ssh/sshd_config and change

PermitRootLogin without-password

(without-password is misleading – it actually means password authentication is disabled for root) to

PermitRootLogin yes

See Ubuntu sshd_config man page for PermitRootLogin options details. Occasionally, I have this option enabled for the intial configurations after Debian installation and immediately disabled it as soon as configuration is completed.

If it is necessary to ssh as root user regularly, I would still disable root authentication by password and

  1. either use certificate for authetication
  2. or logon as other user and “su -” to switch to root to perform the necessary admin tasks and then exit.

It is best stick to the best practices and use “sudo” for any administrative tasks.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.