VSFTP
From WL-HDD Wiki
| WL-HDD Contents |
|---|
| What is the WL-HDD |
| Features |
| Pro's/con's |
| Reviews |
| Hacking |
| Inserting the HDD |
| Hacking Guides |
| Basic setup guides |
| Packages guides |
| Requests |
| Troubleshooting |
| This Wiki |
| Credits |
| Editing help |
| Contact Me |
Contents |
Prerequisites
To complete this guide, the following is assumed:
| You are running Oleg's firmware (1.9.2.7-6b or later) |
| You have harddisk partitions up and running with an extended filesystem mounted to /opt |
| You have installed the Ipkg package system. |
| You have configured your partitions to automount. |
Install
VSFTPD is a xinetd daemon. Therefore, we need to first install the xinetd package. We can do this using the ipkg package system.
ipkg install xinetd
Having done this, we can now install vsftpd itself.
ipkg install vsftpd
Configuration
Now we need to edit the configuration file.
nano /opt/etc/vsftpd.conf
Add this line at the bottom.
secure_chroot_dir=/opt/usr/share/empty
To lock users in their home directory add this line to your vsftpd.conf
chroot_local_user=YES
The reference above points to a non-existent directory. Lets create it.
mkdir -p /opt/usr/share/empty (the -p flag creates all parent directories such as /share)
When xinetd starts, it will automatically run some services that are not necessary on the WL-HDD and would waste memory. Lets get rid of these.
rm /opt/etc/xinetd.d/telnetd rm /opt/etc/xinetd.d/ftp-sensor
Startup
Now lets create the vsftpd xinetd script
nano /opt/etc/xinetd.d/vsftp
Enter the following lines into the file. Remember to change the line user = admin to your username. If you have never changed your username, admin is the default and leave it at that. If you have changed your username (admin) via the web-interface or otherwise, then you will need to enter the new username. Your username is the same one you use both to login to the web-interface and for telnet/SSH sessions.
# description: The vsftpd FTP server serves FTP connections.
# it uses normal, unencrypted usernames and passwords for auth
service ftp
{
disable = no
socket_type = stream
user = admin
server = /opt/sbin/vsftpd
server_args = /opt/etc/vsftpd.conf
wait = no
nice = 10
only_from = 0.0.0.0/0
}
Now make this script executable
chmod +x /opt/etc/xinetd.d/vsftp
Now make the log file, the default location is /opt/var/log/vsftpd.log
mkdir -p /opt/var/log cd /opt/var/log touch vsftpd.log
TO start vsftpd, you need to first stop stupid-ftpd. To do this type.
killall stupid-ftpd
or
ps -e kill # (where # is the PID for stupid-ftpd
This second method lists all the running processes on the WL-HDD with their PID numbers. The kill command then kills the process corresponding to the PID number.
Now we can start the xinetd daemon and at the same time, the vsftpd server.
/opt/etc/init.d/S10xinetd
The vsftpd server should start and will also start automatically after reboots (the S10xinetd script is in the /opt/etc/init.d folder).
Testing
To check vsftpd started, type
ps -e|grep xinetd
You will get the following returns:
[jono@asus root]$ ps -e|grep xinetd 90 jono 432 S /opt/sbin/xinetd 400 jono 264 R grep xinetd
Now go to a windows command line or linux terminal and type
ftp 192.168._._ (your WL-HDD's IP address) username (your username) password (your password) ls (lists the current directory)
If you are logged in as root, ls will display the contents of /tmp/local/root Your FTP server is now working. To make it accessible from the web (outside your LAN, run the FTP from WAN guide.
