add key ssh remote host code example
Example 1: copy remote ssh key mac
cat ~/.ssh/id_rsa.pub | ssh <user>@<hostname> 'cat >> .ssh/authorized_keys && echo "Public key successfully copied"'
Example 2: ssh copy id to remote sever
1. ssh-keygen (press enter / do not enter any passwords)
2. ssh-keyscan hpc.university.edu > known_hosts (press enter)
3. ssh-copy-id [email protected] ( press Enter) #you might need some password to go through university VPN in this case , you can enter them )