Secure Shell Protocol

Secure Shell Protocol

A encrypted network protocol for operating network services securely over an unsecured network.


Usage

Action Command Notes
Connect ssh <user@host>
Custom Port ssh -p <port> <user@host> default port is 22
Identity File ssh -i ~/.ssh/<key> <user@host> will check all keys otherwise
Copy Key ssh-copy-id -i ~/.ssh/<key>.pub <user>@<host>

SSH Key

SSH keys provide a secure, passwordless way to authenticate. Ed25519 algorithm is the current standard for security and performance.

  1. Generate key pair.
ssh-keygen -t ed25519 -C "user@machine"
  1. Distribute to server.
ssh-copy-id -i ~/.ssh/<key>.pub <user>@<server-ip>

# ex. ssh-copy-id -i ~/.ssh/id_ed25519.pub <user>@<server-ip>

SSH Hardening

Edit /etc/ssh/sshd_config, uncomment and set following lines:

  1. PermitRootLogin to no.
  2. PasswordAuthentication to no.
  3. UsePAM to no.

X11 Forwarding

sudo pacman -S xauth xhost

Edit /etc/ssh/sshd_config, uncomment and set following lines:

  1. X11Forwarding to yes.
  2. X11DisplayOffset to 10.
  3. X11UseLocalhost to yes.
sudo systemctl restart sshd
xhost +local:
Powered by Forestry.md