VSFTPD Script

From WL-HDD Wiki

Jump to: navigation, search
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.

This script has only gone through some very basic testing so may not work yet.

I am not responsible if this messes up your WL-HDD setup, in fact, I am not responsible for anything!

All feedback is welcome!

Despite the warning above, this script should not cause any irreversible problem to your WL-HDD!

Removing Previous Installations

If you have previously installed VSFTPD and/or xinetd, remove them using the method below to avoid trouble:

ipkg remove vsftpd
ipkg remove xinetd

Manual Removal

And if any of the files or directories below exist, remove them. This should not be necessary if you use the ipkg remove commands.

rm /opt/etc/vsftpd.conf
rm /opt/var/log/vsftpd.log
rm /opt/etc/xinetd.conf
rm /opt/etc/vsftpd.chroot_list
rm -rf /opt/etc/xinetd.d
rm /opt/etc/init.d/S10xinetd

Getting the Script onto your WL-HDD

OK, first of all, we need to get the script onto the WL-HDD so it can be executed.

There are a few ways of doing this:

Option 1: Wget

This command will download the script from the internet (will only work if you are connected!!!)

Go to the folder /opt

cd /opt

type the following:

wget http://www.sprayfly.com/wlhdd/scripts/vsftpdsetup

Make it executable

chmod +x vsftpdsetup

Now make any necessary changes (such as to usernames and configurations- read the comments inside the script when you nano it)

nano vsftpdsetup

(changes)

Ctrl + O
Ctrl + X

Now lets run it!!!

./vsftpdsetup

Option 2: Pasting into nano

Go to the directory /opt

cd /opt

Now lets create vsftpdsetup

nano vsftpdsetup

Now paste into your editor the following, make any necessary changes (such as to usernames and configurations- read the comments inside the script):

#!/bin/sh
#Install vsftpd and xinetd
ipkg install xinetd
ipkg install vsftpd

#Add Secure Chroot Line to VSFTPD config file
echo "secure_chroot_dir=/opt/usr/share/empty">>/opt/etc/vsftpd.conf

#Lets make that directory we just referred to
mkdir -p /opt/usr/share/empty

#Now lets remove the unwanted xinetd.d services
rm /opt/etc/xinetd.d/telnetd
rm /opt/etc/xinetd.d/ftp-sensor


#Now lets create the vsftp startup script. Remember to change the user to the root user (admin is default).
echo "# 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
}">>/opt/etc/xinetd.d/vsftp


#Lets make the script executable
chmod +x /opt/etc/xinetd.d/vsftp


#Lets make the log directory and log file
mkdir -p /opt/var/log
touch /opt/var/log/vsftpd.log

#Lets kill stupid-ftp if running
killall stupid-ftpd

#Lets run VSFTPD
/opt/etc/init.d/S10xinetd
#Nice message, please keep this in:
echo VSFTPD Setup Complete! This Script was created by Jonathan Lumb. The wiki can be found at http://www.sprayfly.com/wiki

Now save and exit

 Ctrl + O
Ctrl + X

Make it executable

chmod +x vsftpdsetup

Now lets run it!!!

./vsftpdsetup

After the install

The script also starts VSFTPD so you don't have to set it running yourself.

Should you reboot the router, VSFTPD will run as it is now part of the startup on the WL-HDD.

Should you see the following line, do not worry, it just means you are not running stupid-ftpd (that is a good thing!):

killall: stupid-ftpd: no process killed

Now lets test it out: VSFTP#Testing

Personal tools