Frequently Asked Question

How to add an SSH key to a user?
Last Updated a year ago

1. Introduction

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 and we will add the key for you.

2. Usage

As the root user you can add an key to another user, you have to specify the full path.

centos@eodc:~$ sudo su
root@eodc:~$ mkdir /home/your_user/.ssh
root@eodc:~$ echo "CONTENT OF YOUR PUBLIC KEY HERE" >> /home/your_user/.ssh/authorized_keys
root@eodc:~$ chown your_user:your_user /home/your_user/.ssh/authorized_keys 
root@eodc:~$ chmod 0600 /home/your_user/.ssh/authorized_keys


centos@eodc:~$ sudo su
root@eodc:~$ useradd -G sudo,developers,webadmin -e 2038-01-19 test_user
root@eodc:~$ mkdir /home/test_user/.ssh
root@eodc:~$ echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDzaaE8XPE6qIKt9a+LRbic8AKHvCOr0p...rHmeq3vCVkCRhhpmzrKs8rw6KNd74MGFNCM3/Zc= your-key@yourhost" >> /home/test_user/.ssh/authorized_keys
root@eodc:~$ chown test_user:test_user /home/test_user/.ssh/authorized_keys 
root@eodc:~$ chmod 0600 /home/test_user/.ssh/authorized_keys

If you like to log in to more than one user on the server using your key, you will need to add your public key to the corresponding users home directory. Refer to articles below if you need more help.
How to create SSH keys?
How to transfer files between local and remote systems using scp?

This website relies on temporary cookies to function, but no personal data is ever stored in the cookies. For further information see our

privacy policy.


Loading ...