This is another thing I have to do rarely enough that I forget the commands, but often enough it’s worth keeping a note of it. I use git, ssh, scp, etc. all the damn time between various computers, and it’s stupid to keep entering passwords every time. You can get around this using ssh-agent. The process is pretty short:
- Generate a public key. Logon to the host want to connect from:
This generates a key pair (of type dsa), both of which are located in the .ssh directory. The files will be id_dsa and id_dsa.pub. The latter file is the public key, and the former the private key. By copying the public key to the .ssh/, we provide ssh with an alternate means of confirming our access rights. Rather than prompt for a password, it checks that the private key (client side) matches that of the server (public key).
- Append the generated key to the servers .ssh/authorized_keys file. The simplest way is:
That’s it. Now you should be able to scp, ssh, or git (via ssh) to that machine without entering a password. You may have to enter the private key (the passphrase you provided when generating your key pairs) the first time you use ssh from the pc (this is the default behaviour on Fedora).
If you run into problems, this is discussed in more detail here.