Emergency Console (SSH)

You can access your instance’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 instance’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 instance password.

Activate the console

You can activate the emergency console from the “Emergency console” section in your instance’s management page by clicking on the “Activate 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 instance’s password.

If your browser supports direct ssh links, you can simply click the “Log into the emergency console” button to launch the command in your default Terminal application.

For reference, the structure of the ssh command is:

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

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

Note

Some versions of OpenSSH might produce the following error upon connection:

Unable to negotiate with X.X.X.X: no matching key exchange method found.
Their offer: diffie-hellman-group1-sha1

You can add this setting to your ~/.ssh/config file to work around the error:

Host console.{datacenter_id}.gpaas.net
KexAlgorithms +diffie-hellman-group1-sha1

Or run the ssh command with the following option for a specific connection:

$ ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 \
  {instance_id}@console.{datacenter_id}.gpaas.net

Please refer to OpenSSH’s website for more information: http://www.openssh.com/legacy.html

Exit the console

Type ~. to quit the console at any time.

Usage

Manipulate files

Once logged into your instance via ssh you may use common Linux commands to manage your instance’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 http://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, PostgreSQL and MongoDB 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