I just installed Ubuntu 14.04 on my server and I was setting up all my config files when I came across this in my sshd_config file:

# Authentication:
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes

This made me very worried. I thought that it was possible that someone could be logging into my server as root without a password.

I tried connecting to my server as root via:

johns-mbp:~ john$ ssh root@192.168.1.48
The authenticity of host '192.168.1.48 (192.168.1.48)' can't be established.
RSA key fingerprint is 40:7e:28:f1:a8:36:28:da:eb:6f:d2:d0:3f:4b:4b:fe.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.48' (RSA) to the list of known hosts.
root@192.168.1.48's password:  

I entered a blank password and it didn't let me in, which was a relief. So my question is: what does without password mean and why is this a default in Ubuntu 14.04?

up vote 131 down vote accepted

From the manpage:

PermitRootLogin

Specifies whether root can log in using ssh(1). The argument must be “yes”, “without-password”, “forced-commands-only”, or "no”. The default is “yes”.

If this option is set to “without-password”, password authentication is disabled for root.

If this option is set to “forced-commands-only”, root login with public key authentication will be allowed, but only if the command option has been specified (which may be useful for taking remote backups even if root login is normally not allowed). All other authentication methods are disabled for root.

If this option is set to “no”, root is not allowed to log in.

Thus without-password allows root login only with public key authentication. This is often used with shell scripts and automated tasks.

  • 2
    Not permitting 'Root login' using password is considered stronger security than allowing it. That said, you should not be logging into root at all, unless no other method (sudo, etc.) will work. – david6 Apr 19 '14 at 21:46
  • 5
    As you can see however, while the man page indicates the default is "yes", Ubuntu has made the default "without-password". – ferrouswheel Jun 9 '14 at 21:37
  • 35
    So without-password means all methods allowed except password? It really sounds like "allowed to login without the need of a password". – Gauthier Sep 12 '14 at 9:09
  • 1
    "All root access should be facilitated through a local logon with a unique and identifiable user ID and then via the su command once locally authenticated. Direct root login is extremely insecure and offers little in the way of audit trailing for accountability." - CIS IBM AIX Guide – Dominik Antal Sep 30 '14 at 15:15
  • 20
    PermitRootLogin now accepts an argument of 'prohibit-password' as a less-ambiguous synonym of 'without-password'. – endolith Sep 16 '16 at 0:57

Actually this setting does pretty much nothing if you are using PAM authentication. At the bottom of the sshd_config configuration file you will find:

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.

The default setting on Ubuntu is to use PAM authentication:

UsePAM yes
  • 1
    In my brief experience, even setting this to no won't make PermitRootLogin without-password actually work, somehow! :( – cregox Dec 2 '15 at 2:34
  • 1
    @cregox if you are using a typical desktop system, you need to do ssh-copy-id -i ~/.ssh/id_rsa.pub user@ip and it creates ~/.ssh/authorized_keys take in mind if you can't log in as root you wouldn't create this file in /root/.ssh/ but it works if you copy the file there – Rutrus May 6 '16 at 1:46

Note that there are legitimate reasons for logging in via root (but using cryptographic keys and never a password). A typical example is remotely sync'ing two servers (to have one of them being used as fail-over). Because the structure must be identical, often a root password is required.

Here is an example using unison for the synchronisation: https://serverfault.com/questions/341985/remotely-use-root-over-ssh-for-unison

  • 2
    Won't logging in with a normal user (using cryptographic keys most likely) and having it belong to the sudo group allow you to do this as well? – NS du Toit Mar 31 '16 at 14:19

In newer versions of sshd "without-password" has been changed to "prohibit-password".

Both version work, probably best to use "prohibit-password" if you can: it explains itself better.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.