Kiriakos Naiskes

GitHub / LinkedIn / YouTube / X

My Most Commonly Used SSH Configurations and Their Uses

A quick overview of my most frequently used SSH configurations and their uses.

Install SSH

Arch

sudo pacman -Syu
sudo pacman -S openssh

Debian

sudo apt update
sudo apt install openssh-client openssh-server

Check SSH daemon status

sudo systemctl --user status ssh-agent.service

Start SSH on boot

sudo systemctl enable sshd.socket

Generate an SSH key

Using SSH keys instead of passwords is way more secure.

For remote machines

ssh-keygen -t ed25519 -f ~/.ssh/keyName

For version control

ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/keyName

Copy SSH key to remote machine

ssh-copy-id -i ~/.ssh/keyName.pub user@host

Create SSH Config file

Host someHost
HostName someHostname
User userName
IdentityFile ~/.ssh/sshKeyName

Host someHost
HostName someHostName
User someUserName
IdentityFile ~/.ssh/sshKeyName

Execute remote commands

ssh remote-machine -t '<command>'

Date: 2024-07-06 Sat 12:37

Emacs 27.1 (Org mode 9.3)