How do I upload/manage files via SFTP/FISH?

SFTP/FISH Protocols

SFTP (SSH File Transfer Protocol) and FISH (Files transferred over Shell protocol) protocols lets user perform different file management operations (accessing, transferring, etc) over the secure channel.

We provide support of SFTP (Secure File Transfer Protocol) by implementing the threaded daemon for SFTP connections processing. It lets you access, manage and transfer files directly to the container via SSH gate, and in such a way, ensures data security.

FISH protocol (Files transferred over Shell protocol) is supported by a number of popular FTP-clients and file managers (e.g. Midnight Commander, Konqueror, lftp, Krusader, etc). It permits access to securely manage a container’s file system.

Let’s see the examples of using these protocols.

SFTP

To access a necessary container via SFTP protocol, you need to have a private key on your local machine which corresponds to the public SSH key previously added to the Cloudjiffy dashboard.

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

If you are a Windows user, you should additionally save the private key which corresponds to your public SSH key (we use the PuTTYgen tool as an example):

      How to use PuTTYgen?

PuTTYgen is used to generate public or private key pair for creating SSH keys. Below is the complete guidance about how to generate RSA key in the Windows operating system:

  1. Once you install the PuTTY on your machine, you can easily run PuTTYgen. For the same, go to Windows -> Start Menu -> All Programs -> PuTTY -> PuTTYgen.
  2. You will see the PuTTY key generator dialog box on your screen
  3. To create a new key pair, select the type of key to generate from the bottom of the screen (using SSH-2 RSA with 2048 bit key size is good for most people; another good well-known alternative is ECDSA).
  4.  You will find a “Generate” button in that dialog. Clicking on it will lead to generating the keys for you.
  5. Now you will need to add a unique key passphrase in the Key passphrase and Confirm passphrase field.
  6. Click on the “Save Public Key” and “Save Private Key” buttons to save your public and private keys.
  7. You will see the text starting with ssh-RSA in the Public key for pasting into OpenSSH authorized_keys file field which is located at the top of the window. Copy that entire text to your clipboard by pressing ctrl+c as you will require the key to paste on your clipboard in the public key tool of control panel or directly on the cloud server.

 We strongly recommended using a passphrase be for private key files intended for interactive use. If keys are needed for automation (e.g., with WinSCP, then they may be left without a passphrase.

Videos illustrating use of PuTTYgen

Using PuTTYgen to generate an SSH key      

And now you can run your SSH client PUTTY.

Note: Only running environments can be accessed.
Now similarly in case of linux machine you can proceed to establish the SFTP connection via FileZilla.

1. Run your FTP-client with SFTP protocol support.

We use FileZilla as an example, therefore, navigate to the Edit > Settings menu item.

2. In the opened window, navigate to the SFTP section.

Select the Add key file button and choose your previously saved private SSH key.

Click OK.

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

4. In the opened window, click the New site button and specify the following parameters:
  • in the Host field, state your SSH host (166535-10347@gate.cloudjiffy.com)
  • in the Port field, enter 3022 value.
  • choose SFTP in the Protocol drop-down list.
  • choose Normal Logon Type.
  • in the User field, enter the Node ID of the desired container (can be seen in the particular environment’s containers list in the separate nodeid column via SSH console) and your User ID (the number before @ symbol in your SSH connection string) separated with a hyphen.

Finally, click the Connect button.

5. After a connection is established, you’ll see the list of container’s folders in the appropriate frames:

That’s all! Now you can proceed to manage and transfer your application’s files over the secure channel. 

FISH

Let’s look at the example of FISH protocol use via establishing a secure connection between a remote container and the Midnight Commander tool.

1. Firstly, ensure you have a private key on your local machine which corresponds to the public SSH key previously added to the dashboard.

The default path will be  /home//.ssh/id_rsa or /home//.ssh/id_dsa file, depending on the key pair type you’ve generated.

2. Check the ownership and attributes 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

Ownership should be stated as your username and attributes should be 400 or 600I.e. your private key should not be available for reading by other users, otherwise, a connection will not be established.

3. Install and run your Midnight Commander.

4. Select F9 to show the menu toolbar. Then open the left or right panel’s menu and choose the Shell link item.

5. In the opened Shell link to the machine frame, enter the following values separated with a hyphen:
  • Node ID of the desired container (can be seen in the particular environment’s containers list in the separate nodeid column via SSH console)
  • Your SSH connection string ({user_id}@{ssh_host}:3022 )

Click OK.

6. When a connection is established, you will see the container’s file structure in the appropriate panel (in our case, on the right).

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


Was this article helpful?

mood_bad Dislike 1
mood Like 0
visibility Views: 11654