User Management in Debian
Add user account to sudoers group
- Elevate/switch to the root account by entering
su - and authenticating with the root password
- Add the user account to the sudo group using the command
usermod -aG sudo <username>
- Verify that the command was successful by running
groups <username>
Disable login for root account
- Edit the
sshd_config file in the text editor of your choice via the following command:
sudo nano /etc/ssh/sshd_config
- Locate the line that contains
#PermitRootLogin yes and uncomment the # symbol and change the yes to no so it reads PermitRootLogin no
- You can also set the line to
PermitRootLogin no-password (I think) to only allow logon via SSH auth keys
- Once root login has been disabled, you can make the change active by running any of the following commands:
/etc/init.d/sshd restart
systemctl restart sshd
service sshd restart