Add pfaffman's keys to your ssh authorized_keys

How to give Literate Computing ssh access to your server

Paste this one line into your server console

ssh-import-id-gh pfaffman

and send the user you log in as (usually root or ubuntu) and your IP address or hostname.

If you have a firewall that limits access to your server by IP address (you would know if you did), the Dashboard IP address is 154.9.154.67.

The Long Version

If ssh-import-id-gh does not work, you don’t understand where to paste that command, or you have a more complicated setup than most people, here are more explicit instructions.

First, you will need to connect to a shell (or “command line”) on your server via ssh or the Digital Ocean console or something similar. If you have ever typed something like cd /var/discourse;./launcher rebuild app, you need to do whatever you do to get there. Then you’ll paste (or even type!) the command below.

Simple case using something like Ubuntu on Digital Ocean with username root or ubuntu

If you are using Ubuntu, you should be able to log in via SSH, or connect via the Digital Ocean console and paste in this command:

 ssh-import-id-gh pfaffman

You should see a few lines of text that ends with something like “SSH keys [Authorized]

That’s the best way, as it will see that authorized_keys is created with the correct permissions.

That should do it, but if you got something that looked like an error, you may need to keep going.

If ssh-import-id-gh says “command not found”

If ssh-import-id-gh fails for some reason, this should work:

mkdir -p -m 700 ~/.ssh 
curl https://github.com/pfaffman.keys >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

If your username is not root or ubuntu I need the username

After you have added my key, all we need to know is the hostname (or IP address) and the username. If you don’t supply a username, we’ll try root, and ubuntu (which are the default for Digital Ocean, AWS, and a bunch of other providers).

sudo access is also required

For most setups, the user that you use (e.g., root or ubuntu) has super user privileges, but if you add a user just for me, please see that the user can use sudo without a password. You can do that like this:

sudo su -c 'echo =username=        ALL = NOPASSWD: ALL > /etc/sudoers.d/=username=' root

If the user you created was not pfaffman, please substitute accordingly.

This will create a user, give it sudo privs and install the key:

sudo adduser --disabled-password --gecos ""  =username=
sudo su -c 'echo =username=        ALL = NOPASSWD: ALL > /etc/sudoers.d/=username=' root
sudo su - =username=
ssh-import-id-gh =username=

If you use Cloudflare, reverse proxy, or a load balancer

If you are using Cloudflare or something else that makes your forum’s domain name not be the same as the name/IP address to use for ssh access, I will need that IP address or hostname for the virtual machine.

If you want to limit ssh access, Literate Computing will be connecting from 154.9.154.67.

1 Like