Secure shell.
SSH lets you log into a terminal on another machine to use the system via the command line.
ssh root@123.12.185.43
SSH Keys
Private/public key pair to encrypt and decrypt traffic sent via ssh.
Generate SSH Keys
ssh-keygen
This will generate private and public key files.
The default key length is 2048 bites. Use -b 4098 for a more secure key.
Check the service you're connecting to for any specific requirements.
SSH Passphrase
Use a passphrase to secure access to your services.
You can revoke the keys if your laptop gets stolen. A passphrase gives you more time to do that before potentially getting compromised.
SSH Agent
Keep your keys in an ssh agent to automatically use them in connections.
eval '$(ssh-agent -s)'
> Agent pid 163858
Once the agent is running, add your key.
ssh-add
> Identity added: /home/user/.ssh/id_rsa (/home/user/.ssh/id_rsa)
SSH Copy ID
Use this command to ssh into a server and copy your pub key. You will be prompted for a password to copy the file, but then will be able to log in without a password.
ssh-copy-id 192.168.1.100
Configuration
Configure ssh targets with an alias for easy access.
~/.ssh/config
Host myhost
Hostname myhost.com
User admin
Port 7822
Access with: ssh myhost
.
SCP
Secure Copy Protocol. Copy files via SSH.
Copy file on configured ssh host to current location:scp HOST:/PATH/TO/FILE .