===== Setup Linux Ubuntu FTP Server =====
==== Requirements ====
- Router capable of port forwarding
- Static IP
- DSL/Cable or the like (fast connection)
- Command line experience
- Nano/Pico or VIM
==== Get Ubuntu ====
First, download an ISO of Ubuntu Desktop 6.06.x or greater...
[[http://www.ubuntu.com/getubuntu/download|Download Ubuntu]]
Burn the ISO to a CD.
==== Install Ubuntu ====
Insert the Ubuntu CD into the computer and then boot up the computer. Make sure you computer is set to start from CD player if a bootable CD is present.
Follow the prompts. They are pretty straight forward and it should only take about 15 minutes to be ready to go.
==== Install VSFTPD ====
Download the latest version [[http://vsftpd.beasts.org/|VSFTPD]]
I used [[ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.0.5.tar.gz|2.0.5]]
Or you can use Ubuntu's apt-get install to do the same.
Open Terminal:
su
[enter root user pasword]
cd /tmp
apt-get install vsftpd
# OR
wget ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.0.5.tar.gz
tar -zxvf vsftpd-2.0.5.tar.gz
cd vsftpd-2.0.5
mkdir /var/run/vsftpd
./configure
make
make install
==== Set Network ====
=== Set Server to a Static IP in Network ===
Back up /etc/network/interfaces
cp /etc/network/interfaces /etc/network/interfaces.bak
make sure you are root then...
Open in VIM or Nano/Pico
nano /etc/network/interfaces
# Change eth0 to match according to your router setup
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# save and Quit then restart network
/etc/init.d/networking restart
=== Open the FTP Port using iptables ===
iptables -A INPUT -p tcp -m tcp --dport 20 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
==== Configure Router ====
Forward ports 20-22 and select a port for passive mode and forward that too
For passive mode choose a very high port number like 35005 and forward that as well
==== Configure VSFTPD ====
Back up Config file
/etc/vsftpd.conf /etc/vsftpd.conf.bak
Then Edit /etc/vsftpd.conf:
Ours looks something like this:
# Run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#background=YES
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# You may change the default value for timing out a data connection.
data_connection_timeout=240
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to Little Linux FTP service.
#
# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
chroot_local_user=YES
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
ls_recurse_enable=YES
#
# This option should be the name of a directory which is empty. Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
#
# This option specifies the location of the RSA key to use for SSL
# encrypted connections.
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
#
#
#pasv_addr_resolve=YES
pasv_enable=YES
#pasv_address=192.168.x.xxx
pasv_min_port=35005
pasv_max_port=35005
#tcp_wrappers=YES
dirlist_enable=YES
use_localtime=YES
log_ftp_protocol=YES
#port_enable=YES