Artifakt Docs
Stacks 5.0 and up
Search
K
Links
Comment on page

SSH / SFTP Access

Give access your team and your partners to your assets and code without

Connecting via SSH

After building an environment, once the platform and Cloud resources have been properly configured, the status of the environment changes to Online. At this point, it becomes possible to initiate an SSH connection to the main Web server.
Depending on the selected platform type (Starter or Scalable), you will have one or more web servers to absorb the traffic to your application. The main web server is the machine from which scheduled tasks (CRON) are configured and executed. These tasks are not configured on all web servers because they need to run only once, hence the existence of a main server.
The following instructions explain how to connect to the main Web server using an SSH client.

Prerequisites

Before attempting to initiate an SSH connection to the main server, please make sure that you meet the following prerequisites:
  1. 1.
    Check that the environment is ready to receive an SSH connection (the environment must have the Online status)
  2. 2.
    Check that you are authorised to connect through SSH to the main server of the environment you are interested in (from Environment → Settings → Access)
  3. 3.
    Check that your current IP is authorised to connect to the instance (from Environment → Settings → Security).
  4. 5.
    If needed, install an SSH client on your computer
SSH key added in Artifakt:
  • Must be the public key.
  • The format should be RSA (including -----BEGIN RSA PRIVATE KEY----- and -----END RSA PRIVATE KEY----- delimiters for the private key).
  • No passphrase needed for the key.
If you receive an error while trying to connect to the main server, please check that you have a valid SSH key pair and that your public SSH key is properly configured for your account.

Connect to the Main Server

To initiate the SSH connection, open a Terminal window and type the following command, replacing the variables with the values corresponding to your environment.
$ ssh [PROJECT_ID]-[PROJECT_CODE]-[USERNAME]@[MAIN_SERVER_IP]
Go to Environment → Settings → Access to find the specific command you can run for your environment. Alternatively, you can also click directly on Run the command to start a Terminal window from the Artifakt Console.
Run the command

Connecting via SFTP

SFTP connection allows you to connect to the persistent disk shared between all web servers available to an environment. This persistent disk stores usually all your assets and persistent data such as images, export files...
Please keep in mind that the SFTP access is also affected by IP Restrictions that you set up at the project level. See IP Restrictions.
For security reasons, you cannot access your source code or any server's files via SFTP.

Prerequisites

Before attempting to initiate an SFTP connection, please make sure that you meet the following prerequisites:
  1. 1.
    Check that the environment is ready to receive an SFTP connection (the environment must have the Online status as well as the servers)
  2. 2.
    Make sure you have a valid SFTP account and your credentials are correct (from Environment → Settings → Access)
  3. 3.
    Check your network is allowed to make external connection on port 22 especially if you are working from your company office.
  4. 4.
    Make sure your IP is allowed to connect to the environment's servers (from Environment → Settings → Security). More about IP restrictions here.
  5. 5.
    If needed, install an FTP client on your computer (example: FileZilla)

New SFTP Account

To create an SFTP account, you need to define a few parameters:
  • Login – Can contain alphanumeric, lowercase characters, as well as dashes (-) or underscores (_).
  • Password – Must contain at least 1 lower case letter, 1 upper case letter, 1 number, 1 special character and be at least 8 characters long.
  • Directories – A list of paths to which the SFTP user will have access. It's a multi-path field, so after adding the first folder path, please press ENTER to validate the path and be able to write an other one. These folder paths must be located inside the /mnt/shared/ folder (root of the persistent disk). Paths must neither begin nor end with a slash (/) character. For example, if you enter media/image, the SFTP user will have access to /mnt/shared/media/image and all subfolders. If you decide to leave this field blank, the SFTP user will have access to the whole /mnt/shared folder.
Creating an SFTP account can take a couple of minutes. To monitor progress, visit the Job list (Environment → Jobs) and look for a job named Update SFTP users.

SFTP Connection

Go to Environment → Settings → Access to retrieve your SFTP user's credentials. Then, start your FTP client, fill in the required information to initiate the connection :
  • Host – By default, main server's IP address.
  • Username – Defined when creating the account.
  • Password – Defined when creating the account
  • Port – Always 22 (default SFTP port).
After a successful connection to the server, you should find yourself at the root of the persistent disk (in the directory /mnt/shared). If you encounter any trouble to connect, please verify the prerequisites.
You cannot create or upload files in the root folder of the disk, use the different folders mount within your code source (e.g. media, var, ...).