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
- You need to have setup SSH keys to authenticate.
- Optional: the frbit CLI, installed and signed in.
- See the direct code access intro for use cases and limits.
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
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
If the login went well, you will see a small welcome message:
––––––––––––––––––––––– ∙ƒ –––––––––––––––––––––––
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
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.