HOWTO: Setup SSH host aliases and paswordless access with RSA key pairs
a) Generate ED25519 public-private key pair
ssh-keygen -t ed25519 -C "<email_address>" // modern system
OR
ssh-keygen -t rsa -b 4096 -C "email_address" // legacy system
b) Skip passphrase entering (do not enter passphrase)
c) Copy public SSH key to remote server
scp -v ~/.ssh/<keyname>.pub <username>@<servername>:~/.ssh/authorized_keys
d) If necessary add new public keys by copying public key into new line of ~/.ssh/authorized_keys
e) Configure host aliases in ‘~/.ssh/config’ file
Host *
PreferredAuthentications publickey,keyboard-interactive
ServerAliveInterval 120
ServerAliveCountMax 30
Host hpdc
User <username>
HostName hpdc.eeecs
Port <port_no>
IdentityFile ~/.ssh/<keyname> // no '.pub' extension required
f) Use ssh and scp as
ssh hpdc OR
scp file.txt hpdc:~
HOWTO: Enable SSH access on macOS
a) Open “System Preferences” -> “Sharing”
b) Tick box next to “Remote login”
HOWTO: Change default SSH port number on macOS
a) Edit /etc/services file replacing default ssh port numbers with custom number
sudo vim /etc/services
b) Stop SSH daemon
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
c) Start SSH daemon
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
http://www.artdecoded.net/blog/how-to-change-the-ssh-port-in-mac-os-x/
HOWTO: Remove entry from ‘known_hosts’ file
ssh-keygen -R *ip_address_or_hostname*