SSH
Created: 2025-11-30
Updated: 2025-11-30
SSH usage guide covering key generation, config setup, and security best practices for secure remote access
SSH usage guide covering key generation, config setup, and security best practices for secure remote access
ssh-keygen -t ed25519 -C "...comment..."~/.ssh/id_ed25519 and a public key ~/.ssh/id_ed25519.pub~/.ssh/authorized_keysssh-copy-id to automatically copy the public key to the remote server
ssh-copy-id user@server_ip# ~/.ssh/config
Host server_alias
HostName server_ip_xxx
Port 22
User user_xxx
IdentityFile ~/.ssh/id_ed25519
ForwardAgent yes
# having this, macos will automatically use the keychain to store the passphrase
Host *
AddKeysToAgent yes
UseKeychain yes
/etc/ssh/sshd_config on the remote server
PasswordAuthentication nosudo systemctl restart ssh