[SoftNAS KB]: Setup of a FTP server

Setup of a FTP server (on Amazon AMI instance)

Symptoms

Customer cannot automatically send status report logs from SoftNAS node.


Explanation

This might be because the mail server cannot access Internet directly. Because of the amount of data attaching logs as an email attachment is not preferred.

Resolution

Install vsftpd

All commands should be run with ‘root’ user. Run the following command in terminal to install vsftpd package:

        # yum install vsftpd ftp -y


Configure vsftpd

Edit vsftpd configuration file /etc/vsftpd/vsftpd.conf,

        # nano /etc/vsftpd/vsftpd.conf

Find the following lines and make the changes as shown below:

    [...]

 ## Set to "NO" ##

 anonymous_enable=NO

 ## Uncomment ##

 ascii_upload_enable=YES

 ascii_download_enable=YES

 ## Add at the end of this  file ##

 use_localtime=YES

 

Start the vsftpd service and make it to start automatically on every reboot:

        # service vsftpd start

        # chkconfig vsftpd on

 

Create FTP user

By default, root user is not allowed to login to ftp server for security purpose. So let us create a testing user called “ftpuser” with password “centos”:

# useradd ftpuser# passwd ftpuser

Connecting to FTP server

Now let us try to connect to FTP server itself with user “ftpuser”:

# ftp 192.168.1.101

Connected to 192.168.1.101 (192.168.1.101)

.220 Welcome to FTP service.Name (192.168.1.101:root): ftpuser

331 Please specify the password.

Password:

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files.

ftp>

 

Notes:

You might see the above error like “ftp:connect:No route to host”. To resolve this error, allow the default ftp port “21” through your firewall or router. In the server side, do the following.

Edit the file: /etc/sysconfig/iptables with the following command

        # nano /etc/sysconfig/iptables

Add the following lines.

  [...]-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT[...]

Save and exit the file. Restart iptables now:

        # service iptables restart