Can I SSH into my website?

Can I SSH into my website? How?

Yes you can, either directly or by using the CLI:

  1. If you haven’t already, add your SSH key to your Platform.sh Account

    Log into your account. In the management console, Move to the top right hand corner of the screen and click the dropdown menu to the left of the settings gear box icon. In the menu, click on Account, then on Account Settings at the top of the page.

    Lastly, click the SSH keys tab to the left of your account information. Name your SSH key in the first field and paste your public key in the second. When you are finished, click Save to save the key.

  2. Directly SSH into the project

    While you’re still in the management console, click on the environment you want to SSH into. At the top right hand corner of the console there will be a dropdown button labeled SSH. When you click it it will expose the command to SSH into your environment.

    For example, to access the dev environment of the project myapp

    ssh 32ldnujngz2hk-dev-54ta5gq--app@ssh.us-2.platform.sh
    

    You can see that this command can be generalized to

    ssh <project id>-<environment name><env name hash>--<project name>@ssh.<region>.platform.sh
    
  3. Using the CLI

    In your terminal run the command

    platform ssh
    

    which will execute the above command based on the branch you are currently checked out as in your local repository. If you are not in a local repository where Platform.sh has been set as remote, the CLI will ask you to select the environment and project you want to SSH into.

    You can bypass this selection with

    platform ssh -p <project id> -e <environment name>