Add key to agent ssh
Start agent and load a key for the session
eval $(ssh-agent) && ssh-add ~/.ssh/id_ed25519
more ssh
all 15 commands →
SSH config file host entry
cat >> ~/.ssh/config <<'EOF'
Host dev
HostName 10.0.0.5
User ubuntu
IdentityFile ~/.ssh/dev_key
ProxyJump bastion
EOF
Escape sequences in session
~.
Check SSH server host key
ssh-keyscan -t ed25519,rsa host 2>/dev/null | ssh-keygen -lf -
Restrict authorized key
echo 'from="10.0.0.0/8",no-agent-forwarding,no-port-forwarding,command="/usr/bin/backup.sh" <pubkey>' >> ~/.ssh/authorized_keys
Connect with specific key
ssh -i ~/.ssh/id_ed25519 user@host