- Create a new user. In the following example, we will name it bob.
root# useradd -m bob
root# id bob
uid=1000(bob) gid=1000(bob) groupes=1000(bob)- Set the password for the new user.
root# passwd bob
Changing password for user bob.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.- In order to add sudo permissions for the new user, add
bob ALL=(ALL) ALLin/etc/sudoersor add bob in wheel group withusermod -a -G wheel bob. - Try to connect SSH with bob user.
ssh bob@localhost- Verify you can switch user to root with bob.
bob$ sudo -i- Disable root SSH login:
- Edit
# vim /etc/ssh/sshd_config - and change
#PermitRootLogin yesintoPermitRootLogin no.
- Now, we can restart SSH server.
root# systemctl restart sshd.service