Setting up an FTP Server
Setting up an FTP Server
This section explains how to set up an FTP server on the Commerce Server to handle files uploaded from the Commerce Manager, such as product images and CSV import files.
If you do not already have an FTP server installed on the server where the Commerce Server web application is deployed, you must install one. There are many FTP server software packages available. On Linux, you can use ProFTPd or vsftpd. On Windows, you can use CrossFTP.
At the time this document was written, a bug existed for Java based clients running on Windows 7 machines that restricted clients from making FTP connections. Windows has a hotfix for this issue, which is located here: http://support.microsoft.com/kb/2754804
Configuring the FTP server
- Create an FTP user for the Commerce Manager to use.
- Set the FTP user's home directory to the assets directory, which is specified in the COMMERCE/SYSTEM/ASSETS/assetLocation setting in Commerce Manager.
- Verify that the FTP user has read/write permissions on the assets directory and its subdirectories.
Configuring the VFS settings in Commerce Manager
The Commerce Manager client uses the VFS setting values in the database to establish a connection to the FTP server. Log in to the Commerce Manager and modify the following settings:
The hostname of the FTP server
The password of the user on the FTP server
The port of the FTP server (default is 21)
The protocol to use for connecting to the FTP server (default is ftp)
In production, only ftp is supported. For development, you can use other protocols supported by Apache Commons VFS, such as sftp or file.
The directory on the FTP server where assets are uploaded. Generally, this should be the same as the assets directory specified in the COMMERCE/SYSTEM/ASSETS/assetLocation setting in Commerce Manager.
Some FTP servers, such as vsftpd, require that this directory be relative to the default directory on login. For example, if the default directory for the user testadmin is /home/testadmin and the assets directory is /home/testadmin/ep/assets, set the vfsRootpath to ep/assets.
The FTP user account
- Changes to the VFS settings only take effect after the Commerce Manager is restarted.
- If you are running the Commerce Manager client on the same machine as the Commerce Server web application, when choosing a CSV for an import job, make sure that the CSV file is not located in the directory specified by COMMERCE/APPSPECIFIC/ASSETS/vfsRootpath. The import will fail due to a write conflict because the Commerce Manager server is attempting to save the uploaded file in the directory that already contains it.
You can also use SFTP, however some settings may require modification depending on the versions of sshd and vsftp. For vsftp 2.0.4 and sshd 4.2, COMMERCE/APPSPECIFIC/RCP/ASSETS/vsfRootPath must be set to the full (absolute) path of the assets directory from the root of the file system. Unlike FTP, it does not resolve paths relative to the user's home directory.
Alternatively, if you are using sshd 5 or later, you can automatically change users to their home directories on login with a configuration similar ot the following:
Subsystem sftp internal-sftp Match group sftponly ChrootDirectory /home/%u X11Forwarding no AllowTcpForwarding no ForceCommand internal-sftp