1. Generate a private and public key pair
Open PuTTYgen, press the Generate button, move the mouse. Once the keys are generated, type your key passphrase or leave blank.
Copy the public key shown on the board and save it temporarily as we will need it later.
If you want to connect using PuTTY, click on save Private key with .ppk extension.
If you need to connect using a command-line interface, click on “Conversions” tab, select “Export OpenSSH key” and save it with .pem extension.
2. Creating User and unlock the password
sudo adduser vishal sudo passwd -f -u vishal
3. Configure new user for SSH
su vishal cd mkdir ~/.ssh vim ~/.ssh/authorized_keys
Now in ~/.ssh/authorized_keys paste the key which we copied from the PuTTYgen board. Once that is done continue with the following commands
chown -R vishal .ssh/ chmod 700 .ssh/ chmod 600 .ssh/authorized_keys
4. Use PuTTY to connect to your server
Open PuTTY and connect as email@example.com
On the left panel, under “Connection” -> “SSH” -> “Auth”, click on browse and select the .ppk file which we saved earlier
If everything is done right, you should be able to SSH to the server with the new user.