How to add an SSH key to a user?#

This guide shows how to add an SSH key to an existing user with a home directory. The SSH daemon queries the .ssh/authorized_keys file and checks the content of this file against the provided private key.

If you are the responsible person of a project, and you don’t have access to an EODC VM please send your public key to support@eodc.eu and we will add the key for you.

You have to use the file with the .pub extension. The other key without a file extension is your private key and should never be shared with anybody. The private key is easily recognized by its beginning: -----BEGIN OPENSSH PRIVATE KEY-----

[remote_user@eodc ~]$ echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCmqcvQgmx6mPuhOsp...oC0oy1oiCRTcCNU4TWKwdpWEzxw== your_email@example.com" >> ~/.ssh/authorized_keys  
[remote_user@eodc ~]$ cat .ssh/authorized_keys    
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCmqcvQgmx6mPuhOsp...oC0oy1oiCRTcCNU4TWKwdpWEzxw== your_email@example.com
[remote_user@eodc ~]$ chmod 0600 ~/.ssh/authorized_keys