How to enable/disable direct root login with FreeBSD

From Ubiquity Server Wiki

Jump to: navigation, search

It's common practice to disable a direct root login on a BSD-based server, and instead first require authentication to a different, non-root user on the system. From there, users will then use the su command to change users (ie. su root).

This feature is commonly changed, however, one way or the other, by modifying your /etc/ssh/sshd_config. Here's how this is done.

# cd /etc/ssh
# vi sshd_config

To disable direct root SSH login, add or change this parameter.

#PermitRootLogin no

To enable direct root login, add or change this parameter.

PermitRootLogin yes


Exit vi by hitting ESC a few times and typing :x and Enter. Now restart SSH.

# /etc/rc.d/sshd restart
Personal tools