Tutorial: SSH Into Your Server

In the first weeks of class, we experimented with accessing a "virtual commune" on a raspberry pi via the terminal, using SSH.

The way we accessed "the commune" can actually also be used to access our local servers (or cloud servers) and run commands on the terminal there.

Essentially there are two ways to perform admin and maintenance on a yunohost server:

  1. via the web admin interface, which can be accessed through the browser (via the IP address of the server, or a domain like yunohost.local)
  2. via the command line, which can be accessed by attaching a keyboard and monitor to your server, or via SSH (the subject of this wiki page)

To access your server via SSH, you need to first find the IP address of your server, and make sure your laptop is connected to the same router as your server (via wifi or ethernet). If your server is in the cloud you don't need to be on the same wifi because the server has a public IP address.

If your server is in the cloud, you can look up its IP address through the web interface of your cloud provider (e.g. Digital Ocean).

If you have a local server, and you have a monitor and keyboard attached to your server, the easiest way to find the IP address is by logging in, and running the command:

ip a

This will print out the IP address of each of the network interfaces of your server. Look for something like inet 147.182.177.135 (but with your IP address). In the rest of the guide, where this IP address appears, use your own IP address instead.

Once you have your IP address, you already know you can access the web admin interface via entering this IP address into the URL bar of your browser on your laptop.

You can also use this IP address to ssh into your server.

Open terminal on your laptop and run the following (but with your actual yunohost username instead of yourusername):

ssh yourusername@147.182.177.135

You will then be prompted to enter your password, after which, you will be logged into the terminal prompt of your server.

Run this command to see what yunohost commands you can run from the command line:

yunohost --help

You can also always reboot your server in this way too (sometimes helpful if it reaches a weird frozen state). Try this out to reboot your server (note this will also temporarily kick you out from SSH because as the server reboots, your ssh session will be logged out):

sudo reboot now

Now that you have SSH access to your server, you can now follow the guide to setting up a tunnel on your server.

This SSH access can be a helpful fallback in case:

  • the yunohost web admin interface ever stops working and you need to debug why
  • you want to do something more advanced or specific that can't be done through the web interface (via the terminal there is no limit to what you can do with your server, even installing software completely outside of the scope of yunohost)

The full yunohost guide on using SSH and yunohost admin from the command line is here.