Arch Linux Create SSH keys to ssh login without password


Generate ssh keys of your current system

$ ssh-keygen -t rsa

Install openssh if not already installed on your system. On arch linux you can install it as follow, for other distribution follow distribution instructions to install openssh

$ sudo pacman -S openssh

If you already have created ssh keys and now created new one and now seeing this message “sign_and_send_pubkey: signing failed: agent refused operation”.
You need to add ssh key to your machine.

$ ssh-add

check if ~/.ssh directory is already created on server, if not created already then login to server using ssh and do following

$ mkdir  ~/.ssh
$ chmod 700 ~/.ssh/ 

Now go back to your machine and upload your generated public ssh key to server

$ cat ~/.ssh/id_rsa.pub | ssh user@server_ip-or-server-name 'cat >> .ssh/authorized_keys'

login by username from your machine

$ ssh user@server_ip-or-server-name

You may need to set permission of authorized_keys file to 600 on server, to do that ssh login into server and set permissions as follow

$ chmod 600~/.ssh/authorized_keys 

enjoy folks 🙂

Advertisements

2 thoughts on “Arch Linux Create SSH keys to ssh login without password

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s