How to Add Ssh Keys with ssh-add In Linux?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/add-ssh-keys-with-ssh-add-in-linux/
PINTEREST
PINTEREST
INSTAGRAM

SSH protocol provides different ways for authentication. Key based authentication is the most secure one. In order to use key based authentication we should store the key in a command place. SSH agents reads keys and uses for authentication with remote system. We can use ssh-add to store keys in a common path.

Key Files

Public and private keys are store in files according to their algorithm.

  • ~/.ssh/identity  holds RSA version 1 identity
  • ~/.ssh/id_dsa  holds DSA version 2 identity
  • ~/.ssh/id_rsa holds RSA version 2 identity

If identity keys are readable by others they can not used by ssh-add.

Start Ssh Agent

ssh-agent  is used to read keys for authentication. ssh-agent  works as daemon. We can simply start it like below.

Start Ssh Agent

Start Ssh Agent

Add Ssh Key

We will add ssh keys with the ssh-add . We will provide the key we want to add. If the key is protected with encryption we need to provide the password. In this example we will add key named mykey . This key is located in the current working directory but we can also provide absolute path of the key.

Add Ssh Key

Add Ssh Key

List Ssh Keys

We can list added ssh keys with the -L  option like below. This will also print the type of the key with the name at the end of the line.

List Ssh Keys

List Ssh Keys

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/add-ssh-keys-with-ssh-add-in-linux/
PINTEREST
PINTEREST
INSTAGRAM

LEARN MORE  Ubuntu, Debian, Kali Ssh Installation

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)