Assuming you are logged in as super user or any other user with sudo access
Step 1
Open your terminal and connect to your Linux using ssh
Step 2
Use adduser command to create new user account and follow the instructions .
sudo adduser your_user
If you want to disable the password for your ssh login to your Linux instances or machine use following command
sudo adduser your_user --disabled-password
Step 3
Switch to your new user account using following command
sudo su - your_user
Step 4
Create .ssh directory inside your_user directory.
mkdir .ssh
Step 5
Assign the 700 permission to .ssh directory so the user can read,write or open the directory .
chmod 700 .ssh
Step 6
Create authorized_keys file inside .ssh directory .
touch .ssh/authorized_keys
Step 7
Assign 600 permission to restrict other user to write or access.
chmod 600 .ssh/authorized_keys
Step 8
Add your public key to authorized_keys. Use cat command to add the public keys .
cat >> .ssh/authorized_keys
And Paste your public kays than press Ctrl+d to exit form cat command.
Step 9
Add your user to super user group using following command.
sudo usermod -aG sudo your_user
Step 10
Verify that you are able connect with your new user you just have created using following command .
ssh -i your_private_key [email protected]_ip