Phabricator Administrator's Handbook/Authorize a client via SSH

This module is about how to upload an SSH public key in Phabricator from GNU/Linux or other Unix-like operating systems.

Phabricator screenshot settings menu with SSH Public Keys
Upload Public Key menu in Phabricator
SSH key upload popup in Phabricator

This guide is useful to be authorized to push in a Phabricator repository via SSH.

How does it work

edit

You can authorize some of your computers to interact with SSH in Phabricator. Only if your computer is authorized you can then interact with git, Subversion or Mercurial via SSH.

To be honest, with git you can also push via HTTP but this is slower and less safe and it's out of the scope of this guide.

Generate an SSH key

edit

First thing, open the terminal with Ctrl+Alt+T. To generate an SSH public/private RSA key pair, digit this command and press enter:

ssh-keygen

You can confirm the default path to the file in which to save the key.

Note: in case you already have a key, abort and go to #Copy your SSH key.

If you want it to be more secure enter a passphrase and then confirm it, else press enter twice.

Side note: nearly 99% of the people does not set a passphrase to their SSH key. This has sense if you keep your computer secure. Anyway note that, even if your distribution may be secure and hardened, you have to trust every single proprietary software you downloaded from the Internet, because every proprietary software inside your computer can access your files and your SSH keys anytime, and they could technically hijack them for every nasty purpose anitime. Anyway, if a software inside your computer is compromised, do not expect that just a passphrase can be your solution to protect your SSH key...

You will get an output like this:

Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
[...]

Now you are ready to copy your SSH key.

Copy your SSH key

edit

Display the content of your SSH public key with this command:

cat ~/.ssh/id_rsa.pub

Copy the entire line. It should be something like this:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCmWY5gs5mVlcsHu51O25 user@computer

Now you can upload it in your Phabricator user.

Upload your SSH key in Phabricator

edit

Now, open a browser web and go on your Phabricator's profile settings and click on SSH Public Keys in the left menu.

On the right-top of the page:
SSH Key Actions > Upload Public Key

  • In Public Key text box paste the content of the file you copied before
  • In Name text box write the name of the file that you have opened before. In my case id_rsa.pub

Then click on Upload Public Key and that's it.