Ssh – verify sshd configuration

configurationssh

How I can verify the configuration of sshd?

For example, I want to make sure that these settings are set and applied:

AllowUsers user1 user2 
PasswordAuthentication no
PermitRootLogin no

Is the only way manually verifying the contents of the file sshd_config, or can I probe sshd to make sure?

Best Answer

There is an extended test mode, invoked with the command line option -T, which does this. For example:

% sudo sshd -T | egrep -i 'allowusers|passwordauth|permitroot'
permitrootlogin yes
passwordauthentication yes

The option has existed in Portable OpenSSH since 2008, cf. commit e7140f2. This was released with 5.1p1, made in July 2008, cf. release notes for 5.1, so it exists in pretty much all OpenSSH server installations supported today.

Related Topic