Step2: Setup Authentication on Remote - SwagatoMondal/Online-Shopping GitHub Wiki

Limiting your access to remote

You might have already logged in to your remote machine using being root, but you might prefer to limit access to user / user-groups.

NOTE

The root user has unlimited permission and can execute any command. Hence it's a best practice to add a user with limited privileges to execute commands. You can still run admin commands using sudo.

  1. In order to add user use the following command -
adduser <user-name>
  1. You'll be prompted for new password, so set one here and press enter -
Enter new UNIX password: 
  1. You'll be asked to enter more details like Full Name, Room Number, Work Phone, etc. This is an optional step and can be skipped.
  2. You want this user to now run root commands, hence you need to add this user to sudo group. In order to do this use this command -
adduser <user-name> sudo

Verifying new user

  1. Now let's try to login using the user we just added. Now run command exit to come back to your local machine.
  2. Now run the following command (Note instead of root we're using the new user-name) -
ssh <user-name>@<IP-address>
  1. You'll be prompted for password, enter the password you just set for this user.

You can check the CLI showing the following -

<user-name>@<hostname>:~$
⚠️ **GitHub.com Fallback** ⚠️