SSH (Secure Shell Protocol) is a secure network connection protocol. They essentially allow us to operate a remote machine from a local machine. They’re designed to work with Unix systems to replace the unsecure Telnet protocol.

We can SSH into computers mainly via a command-line interface, with tools like the PowerShell or PuTTY.

Generating tokens

On Linux environments:

  • We generate an SSH key pair with ssh-keygen -t ed25519 -C "email@email.com"
    • We can set the file location. Default is okay on shared machines, because this will write to ~/.ssh so it’ll be in the user directory.
    • And set a passcode.
  • Copy the public key at ~/.ssh/id_ed25519.pub.
  • Optionally, we may want to avoid adding the SSH key passphrase repeatedly. In our shell profile (~/.bashrc or ~/.zshrc), we can use ssh-agent or keychain:
if [ -z "$SSH_AUTH_SOCK" ]; then
	eval "$(ssh-agent -s)"
	ssh-add ~/.ssh/id_ed25519
fi
 
eval "$(keychain --eval --quiet id_ed25519)"
  • This allows us to enter the SSH passphrase a single time, which is then persisted in memory for the session.