Archived post: posted sometime between 2016 and 2022.

Open-SSH commands that are helpful to me on a regular basis

On the Client

// Start the ssh-agent
eval `ssh-agent -s`

// Create a new key; as a convention...
// 1. put the user as a comment
// 2. name the file as hostname_algorithm
ssh-keygen -t rsa -b 4096 -C "shaunluttin" -f ~/.ssh/hostname_rsa

// Add a passphrase-protected key to the agent
ssh-add ~/.ssh/hostname_rsa

// Use a specific key (instead of the default key) to connect to the host
ssh user@ipaddress -i ~/.ssh/hostname_rsa

// Configure a specific key file for a specific host
// so you do not have to use -i each time
vim ~/.ssh/config

// This is the syntax for the ~/.ssh/config
HOST ipaddress
  IdentityFile ~/.ssh/hostname_rsa
// Copy the key to the remote
ssh-copy-id -i ~/.ssh/ user@host

On the Server

// edit the authorized keys
vim ~/.ssh/authorized_keys
SSH Command - Usage, Options, Configuration | SSH.COM
“ssh” command usage, options, and configuration in Linux/Unix.
How to use ssh-keygen to generate a new SSH key | SSH.COM
Ssh-keygen is a tool for creating new authentication key pairs for SSH. This is a tutorial on its use, and covers several special use cases.
Ssh-copy-id for copying SSH keys to servers | SSH.COM
Using ssh-copy-id to install SSH keys on servers as authorized keys for passwordless authentication. Options and troubleshooting.