SFTP/FISH Protocols

SFTP (SSH File Transfer Protocol) and FISH (Files transferred over Shell protocol) allow you to securely manage files, including accessing and transferring them.

We support SFTP by implementing a threaded daemon for processing SFTP connections. This allows you to securely access, manage, and transfer files directly to the container via SSH Gate.

The FISH protocol is supported by several popular FTP clients and file managers, such as Midnight Commander, Konqueror, lftp, and Krusader. It allows you to securely manage a container’s file system. Let’s look at some examples of using these protocols.

SFTP

To access a container via the SFTP protocol, you need a private key on your local machine that matches the public SSH key added to the platform dashboard.

For Linux/MacOS users, this private key is saved automatically during key generation. If you are a Windows user, you need to save the private key corresponding to your public SSH key (we’ll use the PuTTYgen tool as an example):

Now we can proceed to establish the SFTP connection.

Step 1. Open your FTP client that supports the SFTP protocol. In this example, we’ll use FileZilla. Go to the `Edit` menu and select `Settings`.

Step 2. In the window that opens, navigate to the SFTP section. Click the “Add keyfile” button and select your previously saved private SSH key. Then click OK.

Step 3. Afterward, go to the `File` menu and select `Site Manager`.

Step 4. In the open window, click the “New Site” button and enter the following details:

  • In the “Host” field, enter your SSH host (gate.{hoster_domain}).
  • In the “Port” field, enter 3022.
  • Select “SFTP” from the “Protocol” drop-down list.
  • Choose “Normal” for the “Logon Type”.
  • In the “User” field, enter the Node ID of the desired container (found in the SSH console under the nodeid column) followed by your User ID (the number before the @ symbol in your SSH connection string), separated by a hyphen.

Finally, click the “Connect” button.

Step 5. Once the connection is established, you’ll see a list of the container’s folders in the appropriate panels.

That’s it! You can now manage and transfer your application’s files securely.

FISH

Let’s look at an example of using the FISH protocol to establish a secure connection between a remote container and the Midnight Commander tool.

Step 1. Ensure you have a private key on your local machine that matches the public SSH key added to the dashboard. The default path is either `/home//.ssh/id_rsa` or `/home//.ssh/id_dsa`, depending on the key pair type you generated.

Step 2. Verify the ownership and permissions of your private key by entering one of the following commands:

  • For RSA key: `ls -la /home//.ssh/id_rsa`
  • For DSA key: `ls -la /home//.ssh/id_dsa`

The ownership should be your username, and the permissions should be 400 or 600, meaning the private key should not be readable by other users. Otherwise, the connection will not be established.

Step 3. Install and run Midnight Commander.

Step 4. Press F9 to open the menu toolbar. Then, in the left or right panel’s menu, choose the “Shell link” item.

Menu Toolbar

Step 5. In the frame that appears, enter the following values separated by a hyphen:

  • Node ID of the desired container (found in the nodeid column of the container list via the SSH console)
  • Your SSH connection string (`{user_id}@{ssh_host}:3022`)

Click OK.

Connection is Established

Once the connection is established, you will see the file structure of the container in the appropriate panel (in this case, on the right side).

Connection is Established

Now, you can securely manage your container’s file system using RSH commands. Enjoy!