SSH access

Published

Updated

🔑

Secure shell access.

Log in to a fortrabbit environment with ssh and an SSH key to run PHP scripts, Composer, artisan or Craft console commands on the live code and data. Each environment has its own SSH login.

Get ready

Accessing SSH

Each environment has its own SSH access. With the frbit CLI, the environment ID is enough:

# Open a shell on the environment
$ frbit ssh {{app-env-id}}

# The same, by app and environment name
$ frbit ssh {{app-name}}/{{app-env-name}}

# Run one command and exit
$ frbit ssh {{app-env-id}} -- php artisan migrate --force

# Print the plain ssh command instead of running it
$ frbit ssh {{app-env-id}} --print
shell

frbit ssh uses the same SSH key as plain ssh. Inside a project linked with frbit link, the environment can be left out. Without the frbit CLI, execute the following in the terminal:

# Connect to your environment via SSH
$ ssh {{app-env-id}}@ssh.{{region}}.frbit.app
shell

If the login went well, you will see a small welcome message:

–––––––––––––––––––––––  ∙ƒ  –––––––––––––––––––––––
raw

Executing scripts

Scripts with the executable bit and a shebang line run directly. A PHP file without the executable bit runs through the PHP interpreter:

$ php artisan some:command
$ php some-script.php
$ vendor/bin/drush status
shell

Some Composer binaries, vendor/bin/drush among them, are shell scripts. Call them directly: php vendor/bin/drush prints the script instead of running it.

Using Composer

With Git deployment, the build commands run Composer, so there is no need to run it over SSH. When it is needed, run composer install, never composer update: an update changes the versions on the environment and leaves the local composer.lock behind.

Limitations

  • No root shell: software packages cannot be installed or removed, see limits.
  • The SSH session shares memory and CPU with the web requests. A heavy command slows the website down; run it as a job instead.
  • Jobs are managed in the dashboard, not in the shell.

Written by humans and AI in collaboration.

AI use & editorial processEdit on GitHub ↗