To add a user account
- Use the following adduser command to add the
newuseraccount to the system (with an entry in the
/etc/passwdfile). This command also creates a group and a home directory for the account.
- Switch to the new account so that newly created files have the proper ownership.
sudo su -
Notice that the prompt changes from
newuserto indicate that you have switched the shell session to the new account.
- Create a
.sshdirectory in the
newuserhome directory and change its file permissions to
700(only the owner can read, write, or open the directory).
chmod 700 .ssh
Without these exact file permissions, the user will not be able to log in.
- Set password for newly created user
[root ~]$ passwd newuser
Changing password for user newuser New password: Retype new password: passwd: all authentication tokens updated successfully.
- Allow user to login using username and password
[root ~]$ vim /etc/ssh/sshd_config
[root ~]$ service sshd restart Stopping sshd: [ OK ] Starting sshd: [ OK ]