How to Access Your Web Hosting via an SSH Emergency Console

You can access your web hosting’s shell via an SSH console. The console is offered as an emergency access, in case you need to perform administration tasks from the shell.

Console access is always temporary and it needs to be activated before accessing it. You can activate the console on your web hosting’s management interface, which is described in the section below.

Once activated, the console will be available for 2 hours. You will be automatically disconnected after that period for security reasons. You will have to re-activate the console and login again after that period expires.

Note

SSH keys are not currently supported for console connections - you can only use the web hosting password.

Activate the Console

You can activate the emergency console from the “Administration & Security” tab on your web hosting’s management page by clicking on the “Enable emergency console” button.

Once the console is activated, the status screen will change to show you for how long the console will stay active. The console will be automatically deactivated after a 2 hour period (it cannot be deactivated on demand). You can activate it again at any time.

Connect to the Console

You’ll need an SSH client installed on your computer to access the emergency console.

Linux and macOS systems should have one installed by default. Windows users can install PuTTY.

After activating the console as described in the previous section, copy-paste the ssh command in your Terminal application to access the console. You’ll need to enter your web hosting’s password.

For reference, the structure of the ssh command is:

$ ssh {web_hosting_id}@console.{datacenter_id}.gpaas.net

The {web_hosting_id} and {datacenter_id} variables are the same that are used for the sFTP, git and Control Panel services.

Exit the Console

Type ~. to quit the console at any time.

Usage

Manipulate Files

Once logged into your web hosting via ssh you may use common Linux commands to manage your web hosting’s files and directories, such as mv, rm, wget, etc. The vim, vi and nano editors are also available.

For example, you call install WordPress using the following commands:

$ cd web/vhosts/wp.gandi.ninja/htdocs/
$ wget https://wordpress.org/latest.zip
$ unzip latest.zip
$ rm latest.zip index.html
$ mv wordpress/* .

Manage Databases

You can manage any of the available databases directly from the console, using the command line tools provided by each one of them.

For example, to connect to MySQL using the default user and password:

$ mysql -u root -h localhost

Check out the specific documentations for MySQL or PostgreSQL for more information.

View Logs

You can view your logs (ex: visitor occurrences, system errors, etc.) on the SSH console.

The logs are located in the /srv/data/var/log directory. You can list all the log files available with the following command:

$ ls /srv/data/var/log/

Once you locate the log file that you want to examine, you use the cat or tail commands to output their content to the console. The tail -f /path/to/my/log/file command will allow you to print the output of a log file in real time.

For example, to see your Apache webserver’s access log in real time, type:

$ tail -f /srv/data/var/log/apache/access.log