FAQs EODC framework

How to add an SSH key to a user?

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/autorized_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.

2. Usage

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

1 2 3 4 5 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


1 2 3 4 5 6 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. 

Was this article helpful?