Configure FTP/SFTP on Hypernode
For some shops FTP/SFTP usage is required to access an external data supplier. For these customers we’ve added the feature to add and remove FTP/SFTP users on your Hypernode. In this article we’ll explain how you can configure FTP/SFTP (create/delete users) and which credentials to use to make a FTP/SFTP connection.
NB: We strongly recommend using SSH or SFTP for file transfers. FTP is an inherently unsafe protocol, and should only be used for syncing data with suppliers that can’t be done through the Magento API.
Table of contents
- 1 Managing FTP users
- 2 Adding Your IP Address to the whitelist
- 3 Connecting to FTP
- 4 ACTIVE mode or PASSIVE mode
- 5 SFTP (SSH File Transfer Protocol)
- 6 Troubleshooting
Managing FTP users
NB: The FTP users created with the instructions below can also be used for SFTP. More information about this can be found here.
Adding FTP users
The first step is to create a FTP user on your Hypernode. This is done through the
hypernode-ftp add command. The syntax of this command is as follows:
hypernode-ftp add --username USER --homedir DIRECTORY
For example if you want to create user
bob with homedir
hypernode-ftp add --username bob --homedir /data/web/
You will be asked for a password and after adding a password the user is created. This creates the user bob which it’s restricted to the folder
/data/web/public and everything that’s in it.
Deleting FTP users
If you want to delete a FTP user you can use the
hypernode-ftp remove command. The syntax of this command is as follows:
hypernode-ftp remove --username USER
We could delete the bob user by using the command like this:
hypernode-ftp remove --username bob
Listing all FTP users
If you want to check which FTP users are enabled you can use the
hypernode-ftp list command. This command returns a list of all available users and their particular homedir:
Users found: bob /data/web/
Or in case you did not add any FTP users yet:
No users in FTPasswd file
Adding Your IP Address to the whitelist
Because FTP is heavily firewalled on Hypernodes, you need to add your local IP address to the firewall whitelist in our Service Panel.
To find out what your IP address is, search for “what is my IP” on Google.
After adding your IP to the firewall whitelist, it can take a few minutes until the changes are configured on the server, so if you keep experiencing a timeout, have a coffee before you try again.
Connecting to FTP
If you want to connect to FTP you’ll have to use the following credentials:
- Hostname: appname.hypernode.io (replace this with the name of your Hypernode)
- User: Your username
- Password: Your password
- 21 For regular FTP
- 2222 For SFTP (you need to opt-in first!)
ACTIVE mode or PASSIVE mode
ACTIVE and PASSIVE mode are 2 techniques for establishing an FTP connection with an FTP server.
FTP uses two channels between client and server, the command channel and the data channel, which are actually separate TCP connections. The command channel is for commands and responses, the data channel is for transferring files.
In active mode, the client establishes the command channel (from client port X to server port 21) but the server establishes the data channel (from server port 20 to client port Y, where Y has been supplied by the client).
In passive mode, the client establishes both channels. In that case, the server tells the client which port should be used for the data channel.
Passive mode is generally used in situations where the FTP server is not able to establish the data channel. One of the major reasons for this is network firewalls. While you may have a firewall rule which allows you to open up FTP channels to appname.hypernode.io, the Hypernode FTP daemon may not have the power to open up the data channel back through your firewall.
Passive mode solves this by opening up both types of channel from the client side.
If you are behind a router or firewall, switching to passive mode is a genuine fix for almost all connectivity problems when using FTP. If you experience connectivity errors, try switching from passive to active mode or vice versa.
SFTP (SSH File Transfer Protocol)
We also offer SFTP on Hypernodes. SFTP allows you to securely copy files from and to the Hypernode using tools like
sftp and it’s windows equivalent
WinSCP. This is done over a secure encrypted connection and can be used for the default user or users that have been restricted to a specific directory.
You can connect using the SFTP protocol on port 2222, using the same credentials as with regular FTP connections.
SFTP for the default user
You can login with the default app user credentials. The below instructions will cover the basics on how to configure this using FileZilla.
Generate an SSH keypair
Start by generating a keypair (a private and a public key). This can be done through a Terminal (Linux and Mac OSX have this program pre-installed) or through PuTTY. How to do this is covered in this article.
Add your public key to the SSH Keymanager
When you have generated the keypair you need to add your public key to your Hypernode. You’ll need to use the SSH keymanager at the Byte Service panel. How this works is explained in the article Using the Keymanager.
Add your private key in FileZilla
After the public key has been added, we need to make sure the private key gets properly configured. As mentioned you can use FileZilla for this task. Follow the steps below:
- Open FileZilla
- Click Edit and select Settings.
- Click SFTP.
- Click Add keyfile (image 1)
- Select your private key and click Open.
- You’ll be asked if you want to convert your private key to a format which FileZilla can use. Click Yes.
- Enter the passphrase you used when generating the keypair and click Ok.
- Give the file a name and select the folder where you want to save the file to.
- Press OK.
Connecting to Hypernode with SFTP
- Select the menu item File and select Site Manager.
- Click New Site and give the new connection a name (default is set to New Site).
- Use the following settings (image 2):
- Press Connect and you will be connected to your Hypernode.
SFTP for restricted users
Similar to FTP you can also grant other users access to only certain directories using the same mechanism as with FTP users.
When using SFTP, you are always chrooted to the homedir. This implies that when you want to copy a file to
/tmp, you will receive an error, as the
tmp/directory does not exist in the configured homedir..
If you experience a ‘Connection timed out’ error, please check in our service panel if your IP address is whitelisted.
- If the IP is whitelisted and you still get this error: Check your local firewall and antivirus logs.