Useful SSH Commands
Generating SSH key
Short read about using ED25519 instead of RSA Medium
To generate a SSH key use:
ssh-keygen -t ed25519 -C "comment"
To add your public key to a server use:
ssh-copy-id user@host
SSH config file
To make it easier to SSH you can set up a config file in the .ssh folder
containing the following.
~/.ssh/config
# global options
User user
# host-specific options
Host myserver
HostName server-address
Port port
With such a configuration, the following commands are equivalent
$ ssh -p port user@server-address
$ ssh myserver
Send a command over SSH:
ssh <user>@192.168.1.1 'ls -l; ps -aux; whoami'
rsync over SSH
rsync -avzh SRC USER@HOST:DEST
rsync -avzh -e "ssh -p $sshport" ~/folder1 $sshuser@$instancehost:~