SSH Public / Private Key Setup

Create Public / Private key pairs

ssh-keygen -t [Type of the key]  -b [Number of bits in the key to create]

e.g. ssh-keygen -t rsa -b 4096

Copy public key to remote server

ssh-copy-id -i [path to public key] [username]@[host]

e.g. ssh-copy-id -i keys/ [email protected]



Public key is always associated with a user when it gets copied onto the remote server. The default location storing the keys is usually ~/[user]/.ssh/. All public keys are appended to the ~/[user]/.ssh/authorized_keys file.