Skip to main content

Deny root login on server

First of all:

Create a simple user with ssh login:

  • $ useradd -m -s /bin/bash username
  • $ passwd username

Open a second shell and log the user in. Try command

$ su

to check, if your user can login as root as well.

After successful test ...

Open /etc/ssh/sshd_config

Set "PermitRootLogin no"

Reload configuration with

/etc/init.d/ssh reload

Open a third shell and try to login as root -> should not be possible anymore.