simplename
simplename

Reputation: 919

ssh: adding private key to ssh-agent before copying public key to remote server

I've used ssh-keygen to generate a ssh key pair, and then ssh-copy-id to copy the public key to the remote server. This has worked for all systems in my local network. I followed instructions similar to this link

However, on bitbucket and github, I see this additional step of adding the private key to the ssh-agent using ssh-add <private key>

This page explains what this additional step but why is that not needed for my local network when it is needed for github and bitbucket?

Thanks

Upvotes: 2

Views: 773

Answers (1)

VonC
VonC

Reputation: 1323145

The "Adding your SSH key to the ssh-agent" documented on GitHub (same on GitLab) is only there if you generate a private SSH key protected by a passphrase (meaning, encrypted)

The idea is that, for a private SSH key used for authenticating to a remote public service like GitHub or GitLab, it is better to have an encrypted key, which makes it less dangerous if said key is leaked.

This is different for a private SSH key used inside a LAN (in your local network): using a passphrase is still a good idea but not mandatory: if the SSH key leak, you still need access to the LAN in order to use it.

Upvotes: 1

Related Questions