You may have already thought about it, how to make login on Unix system more comfortable and easier? In this short article we will will focus on ssh.
How to make a login by SSH key?
First of all you need to check if you have a generated public key. The location of that key you can find in the .ssh folder by user directory like:
Under that path you should see a files like “something” and “something.pub” if you don’t have those files, you have to generate them with the command:
ssh-keygen -t rsa
Transfer your key to remote host
This command will copy your public key to the remote host and add it to the ~/.ssh/authorized_keys file:
ssh-copy-id -i ~/.ssh/id_rsa.pub user@remotehost
You will be asked to type your password after you have used above command.
Now you can connect to your server via command: