Vsftpd

vsftpd stands for Very Secure FTP Daemon, and it's one of the more popular FTP daemons around. vsftpd is high-profile, very configurable and is generally considered more secure than other FTP servers. SCP and HTTP have generally superseded FTP for transferring files over the internet, but there may still be situations where FTP makes the most sense. In particular, the MyBook's ARM processor is slow enough that the encryption overhead from SCP significantly impacts performance.

Installation

If you have Optware installed, you can easily install vsftpd using the ipkg installer:

ipkg install vsftpd

ipkg will put the necessary files under /opt, and give instructions to add the following line to /etc/inetd.conf:

ftp stream tcp nowait root /opt/sbin/vsftpd /opt/etc/vsftpd.conf

For some reason, my install of vsftpd 2.0.5-1 insisted on reading the configuration from /etc/vsftpd.conf despite being told to read from /opt/etc/vsftpd.conf in inetd.conf. If you run into this problem, you can solve the problem by creating a symlink:

ln -s /opt/etc/vsftpd.conf /etc/vsftpd.conf

With optware vsftpd >= 2.0.7-1 this issue should have been solved, and you no longer need the symlink above.

As a good security practice, it's better to have vsftpd run as a non-privileged user rather than as root. By default, it wants to run as user 'ftp', but the configuration that comes from the optware install uses 'ftpsecure' (see the nopriv_user setting in the configuration file). You should add this username to /etc/passwd. Make sure to select a unique user id (in this example, the UID is 104):

ftpsecure:x:104:99:Operator:/var:/bin/sh

Since vsftpd is controlled by inetd, no changes need to be made to the startup scripts, but inetd does need to be restarted for the change to take effect. Starting inetd is controlled by the S30network startup script, so restart it like this:

/etc/init.d/S30network restart

You should now have a working vsftpd server on your WD MyBook.

Troubleshooting

If the user vsftpd expects to run as doesn't exist (say, as in my case, because it isn't reading vsftpd.conf in the expected location), you will get an error message like this one when you try to ftp into the server:

500 OOPS: vsftpd: cannot locate user specified in 'ftp_username':ftp

Make sure vsftpd is reading the configuration file in the expected location and the username specified exists in /etc/passwd.

The log file path specified in the default configuration file does not exist. You will get an error message like this one when you try to connect to the server:

500 OOPS: failed to open vsftpd log file:/opt/var/log/vsftpd.log

Create the directory /opt/var/log/ or change the configuration file so that the logfile is stored at another place (i.e. /var/log/ )

If you get a login error with local users, check if the user shell is /bin/bash in your /etc/password. In this case, replace /bin/bash for /bin/sh.

Logging

If you've configured your WD MyBook to spin down when not in use, you may want to change vsftpd's log location to the ram disk:

vsftpd_log_file=/mnt/ramdisk/vsftpd.log

If you're positive you don't want logs, you can always set the location to /dev/null.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License