Our Blog

Latest news and updates from flathost

How to generate SSH key and add to the ssh agent?

Posted by shazim on 26 01 2017. 0 Comments

As we know all time we access the ssh of any system by using the username and password so we can avoid this by adding the ssh to agent system.if you don’t want to re enter the password of ssh then add your key to the ssh agent.

Step1: Open ssh Gt bash.

Step2: Generating new ssh key.

ssh-keygen -t rsa -b 4096 -C “[email protected]
it will create the ssh key.

Step 3: When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the default file location.

Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]

Step 4: At the prompt, type a secure password.

Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

Adding your SSH key key to ssh-agent:

Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key.

Ensure the ssh-agent is running:

The ssh-agent should be running.

If you are using another terminal prompt you can use the “Auto-launching the ssh-agent” instructions in “Working with SSH key passphrases”, or start it manually:

# start the ssh-agent in the background

eval $(ssh-agent -s)
Agent pid 59566

Add your SSH key to the ssh-agent. If you used an existing SSH key rather than generating a new SSH key, you’ll need to replace id_rsa in the command with the name of your existing private key file.

$ ssh-add ~/.ssh/id_rsa

Leave a Reply

Your email address will not be published.