login as root
create new user account:
# useradd -m -s /bin/bash mschmid
set password:
passwd mschmid
add user to sodoers (on rhel and cestos, use „wheel“ instead of sudo)
# usermod -aG sudo mschmid
add public ssh key to <username>/.ssh/authorized_keys
test ssh access:
$ ssh -l mschmid remote.server.name.here
to disable root login, open ssh config:
$ sudo vi /etc/ssh/sshd_config
set ChallengeResponseAuthentication to no:
ChallengeResponseAuthentication no
set PasswordAuthentication to no and disable login for accounts w/o pasdsword
PasswordAuthentication no
PermitEmptyPasswords no
set UsePAM to no:
UsePAM no
set PermitRootLogin to no:
PermitRootLogin no
PermitRootLogin prohibit-password
reload ssh
# /etc/init.d/ssh reload
Login with user root and password auth should be denied:
$ssh -l root remote.server.name.here
$ssh mschmid@remote.server.name.here -o PubkeyAuthentication=no