Notice that when you use ssh or scp without doing anything else, it will ask
you for your password on the remote machine. Every time. That gets tiresome
pretty quickly, so fortunately there's a better way to set up your remote login.
SSH on Windows
Windows users might not have have access to the ssh and ssh-keygen command line
programs; instead, you can use a Windows application named “PuTTY.” a to generate
keys and login to remote systems.
Set Up SSH Keys
This setup takes a couple of steps, but they are pretty straightforward. We'll
go into the details next, but the overall steps are as follows:
Generate a special set of secret keys, including a “public key.”
Copy the public key to the remote machine.
Make sure the public key is secured on the remote machine.
Once that's done, you can use ssh and scp without having to supply a password.
That means you can use ssh and scp from shell scripts—which can be very
handy when you need to do a bunch of things to the remote machine.
Here are the steps in detail.
First off, change to your home directory and use ssh-keygen to generate a set
of RSA-style keys: 3
$ ssh-keygen -t rsa
When asked for a passphrase, press Enter —don't input text at this point. That
command will make a subdirectory named .ssh under your home directory.
Because of the leading dot (“.”) you won't normally see this directory listed
with ls , but ls-a will show it:
$ ls -a
. .. .profile .ssh (and a bunch of other stuff)
$ cd .ssh
RSA is a public-key-style cryptographic system, named for its inventors.