devops-basics

SSH Basics

Generate an SSH key pair

ssh-keygen -t ed25519 -C "[email protected]"

This creates two files by default:

Copy your public key to a remote server

ssh-copy-id user@remote-host

This appends your public key to ~/.ssh/authorized_keys on the remote host, enabling passwordless login.

Connect to a remote server

ssh user@remote-host

Connect using a specific key and port

ssh -i ~/.ssh/id_ed25519 -p 2222 user@remote-host

View known hosts

Every server you connect to gets fingerprinted in:

cat ~/.ssh/known_hosts

Copy files with SCP

scp localfile.txt user@remote-host:/home/user/