Search

Ali Jelveh (Protonet Support) 04.05.2016 - 3:43

How do I add a new linux user with a public key

I’d like to add a new linux user and have him being able to access the box with ssh and his ssh key, is there a tutorial for that?

🙂

Last modified: 04.05.2016 - 10:16

One answer

Martin 04.05.2016 - 10:23

Hi Ali,

I translated our German tutorial for logging in with a private key for you below.

However, creating new linux users on Protonet servers is not advisable due to our security infrastructure – I suggest you wait just a little longer until SOUL 3.0 is available. It will make it much easier to customize your Protonet server to do new an additional tasks due to it’s new structure. If you use our support form to send us a more detailed description of what you have in mind, we will be happy to help though! 🙂

To use a private key to log in, we need to prepare a directory as follows:

​sudo su –

mkdir -p /protonet/firmware/local_patches

After this, place your public key in this directory. Name it id_rsa.pub for the following script to work.

Next, open a text editor and place the following script into a file called install_key_auth.sh the same directory.


#!/bin/sh

# create the .ssh folder

mkdir -p /home/protonet/.ssh

# make sure the authorized_keys file exists in that folder

touch /home/protonet/.ssh/authorized_keys

# add our key to the authorized_keys file

cat /protonet/firmware/local_patches/id_rsa.pub >> /home/protonet/.ssh/authorized_keys

You can then run the script or restart the server to enable login with the public key.

Hope this helps!
Martin