Secure Shell (SSH)
A means of securly connecting to a remote computer's shell.
Public / Private key
When attempting to connect, the command will look at your "~/.ssh" directory and enumerate through all the keys there (prior to this your public key will have been added to the remote host).
Key Generation
ssh-keygen
ssh-keygen -t rsa -b 4096 -C "$(git config kevin@bluer.com)" -f gh-pages-actions -N ""
Copying Keypair to host
In the following example, the -i
is the identity you're copying...
ssh-copy-id -i raspberry pi@192.168.86.181
ssh-copy-id pi@192.168.86.45
Connecting with a specific Keypair
ssh pi@192.168.86.181 -i ~/.ssh/raspberry
ssh pi@192.168.86.45 -i ~/.ssh/raspberry
An example with agent forwarding...
ssh -A -i ~/.ssh/xyz you@42.171.111.35
More detail on ssh-agent here.
SSH Add
ssh-add is a command for adding SSH private keys into the SSH authentication agent for implementing single sign-on with SSH.
ssh-add <keyname>
List
Lists public key parameters of all identities currently represented by the agent.
ssh-add -L
Using Keys
Example using a .pem file...
ssh -i ~/.ssh/xyz.pem 52.255.202.123
Note that it will need to be permissioned correcty...
sudo chmod 600 ~/.ssh/xyz.pem
Remember hosts
Add the following (example) to your ~/.ssh/config
file...
Host bluer.com
HostName 163.217.8.40
IdentityFile ~/.ssh/bluer
User kevin
This will then allow you to tab complete from the terminal...e.g.
$ ssh bluer.com