SFTP and FISH protocols for SSH access to Jelastic containers

    Earlier, we talked about SSH access to the Jelastic cloud and its features:
    • SSH gateway as a new infrastructure element
    • generating and adding an SSH key to a Jelastic account
    • direct SSH container access

    In this article, we would like to draw attention to some additional ways of SSH access to Jelastic containers, namely, using SFTP (SSH File Transfer Protocol) or FISH (Files transferred over Shell protocol) protocols. These protocols allow you to carry out various operations with files (access, transfer, etc.) over a secure channel.


    Support for SFTP (Secure File Transfer Protocol) in Jelastic is provided by implementing a streaming daemon to handle SFTP connections. This allows you to access, manage and move files to the container through the SSH gateway, and thus be sure of the security of your data.

    FishThe protocol (Files transferred over Shell protocol) is supported by many popular FTP clients and file managers (e.g. Midnight Commander, Konqueror, lftp, Krusader, etc.). This makes it possible to safely manage files in the container.

    Now, let's look at a few examples of using these protocols.

    SFTP protocol

    In order to access the required container via the SFTP protocol , your local machine must have a private SSH key that corresponds to the public one previously added to the Jelastic account.

    For Linux / MacOS users, this private key is automatically saved during key pair generation.

    If you use Windows, then you need to additionally save the corresponding private key (as an example, we use the PuTTYgen application):


    Now we can proceed to establish an SFTP connection.

    1. Launch your SFTP-enabled FTP client.
    For an example we will use the Filezilla program. Select Edit> Settings from the application menu.


    2. In the window that opens, go to the SFTP section and, using the Add keyfile button , select the previously saved private SSH key.
    Click OK .


    3. After that, go to the menu item File> Site Manager .


    4. In the window that appears, click the New site button and specify the following parameters:
    • in the Host field, enter your SSH host (gate. { host_domain })
    • in the Port field, paste the value 3022
    • select SFTP in the protocol drop-down list
    • set to Normal for the Logon Type option
    • in the User field, enter the Node ID of the container that you want to access (this value can be found in the list of environment containers in a separate column nodeid using the SSH console), and add a User ID through the hyphen (the number before the @ symbol in the line for the SSH connection) .

    Click Connect .


    5. Once the connection is established, you will see a list of folders of this container in the corresponding part of the program window.


    That's all! Now you can start managing and transferring your application files through a secure channel.

    FISH protocol

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

    1. First, make sure that your local machine has a private SSH key that matches the public key previously added to the Jelastic control panel.

    By default, the path to the generated key will be /home/{username►/.ssh/id_rsa or /home/{username►/.ssh/id_dsa (depending on the type of key).

    2. Check the ownership and attributes of your private key using the following commands:
    • for RSA key
      ls -la /home/{username►/.ssh/id_rsa
    • for DSA key
      ls -la /home/{username►/.ssh/id_dsa

    In the column of the owner of the key should be the name of your user , and the attributes should be 400 or 600 . In other words, your key should not be readable by other users, otherwise the connection will not be established.

    3. Install and run Midnight Commander .

    4. Call the menu bar by pressing the F9 key, and select Shell link in the menu of the left or right tab.


    5. In the Shell link to machine dialog that opens, enter the following values ​​through a hyphen:
    • Node ID of the container to access (this value can be found in the list of environment containers in a separate nodeid column using the SSH console)
    • your line for an SSH connection ( {user_id} @ {ssh_host}: 3022 )

    Click OK .


    6. Upon completion of the connection, the selected panel (in our case, on the right) will display the files and folders of the container.


    Now you can safely manage the file system of your container using RSH commands. Good luck


    Thus, using the SFTP and FISH protocols, you can manage files inside the container over a secure channel. As a bonus, you get extremely fast file transfers and the ability to manage attributes of files and directories. Try it yourself and see all the benefits of SSH access to Jelastic Cloud!

    Also popular now: