Quantcast
Channel: Recent Gists from 84adam
Viewing all articles
Browse latest Browse all 34

Create new sudo user; disable root login via SSH

$
0
0
noroot-ssh.txt
# create a new non-root user
adduser <new-username>
# follow prompts
# give sudo permissions to the new user
usermod -aG sudo <new-username>
# check groups for new user
groups <new-username>
# edit sshd_config settings
vim /etc/ssh/sshd_config
# change `PermitRootLogin` from yes to no
# Authentication:
#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
# save the changes
# restart the ssh daemon
systemctl restart sshd
# check the status of sshd
systemctl status sshd
# test from another terminal:
# try logging in as the new user and then becoming root with:
sudo su -
# if the above works, try logging in as root again over SSH
# expect this to fail
# if you enter the correct password, you should still get an 'access denied' error message

Viewing all articles
Browse latest Browse all 34

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>