
ssh keys: ssh-keygen & ssh-copy-id quick and simple
Ssh keys are a great way to simplify remote access to your linux server. By default you will likely set up a username and password scenario where every time you need to connect to the server through the console or to copy files using scp, sftp you need to enter your password. If you need to access your server frequently and need to copy files regularly then setting up ssh keys will make life much easier. To spell it out, once you set up your ssh keys you will no longer need to enter your password from the machine which you copy your keys from. It may seem unintuitive at first(It was for me). But it is more secure believe it or not.
Quick and Dirty
To keep this as quick and simple as possible we will skip directly to ssh-copy-id.
Step one ssh-copy-id
On your local linux computer console enter: ssh-copy-id yourusername@thenameofyourserverIf you already have keys the server will ask for your password. Enter the password and the keys will copy. The next time you try to connect/login to the server you will not be asked for a password.
If you do not have keys it will tell you that you have no keys. If you have no keys don't worry. In the next step we will generate them.
Step two ssh-keygen
Generate keys with ssh-keygen:type: ssh-keygen
When asked to enter file in which to save key: Press enter
When asked for password: Press enter for no password. Then enter again for no password.
Now go back to step one and use ssh-copy-id.
congratulations you can now ssh into your server without entering a password from your local computer.