Wednesday, September 16, 2009

Setting Up a secure fast ftp server for linux | VSFTP

#################################################
# setting up a ftp server #
# http://vpslife.blogspot.com/ & http://vpswatch.com/
#################################################

wget ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.2.0.tar.gz
tar zxvf vsftpd-2.2.0.tar.gz
cd vsftpd-2.2.0
make
adduser nobody
adduser: user nobody exists
mkdir /var/ftp/
useradd -d /var/ftp ftp
(the next two are useful to run even if the user "ftp" already exists).
chown root.root /var/ftp
chmod og-w /var/ftp
Install vsftpd config file, executable, man page, etc.
make install
cp vsftpd.conf /etc
# open conf file and edit
vi /etc/vsftpd.conf
# set anonym ftp to no!
anonymous_enable=NO
# set local users can login and uncomment
local_enable=YES
# set write enable to yes and uncomment
write_enable=YES
#other settings
local_umask=022
connect_from_port_20=NO

chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list

##save file

#add users that you want enable ftp
vi /etc/vsftpd.chroot_list
#I added two user
www-data
mustafat
#add following lines to pam file
vi /etc/pam.d/vsftpd

# Standard behaviour for ftpd(8).

auth required pam_listfile.so item=user sense=allow file=/etc/vsftpd.chroot_list onerr=fail


# Note: vsftpd handles anonymous logins on its own. Do not enable
# pam_ftp.so.

# Standard blurb.
@include common-account
@include common-session

@include common-auth
auth required pam_shells.so
account required pam_unix.so
session required pam_unix.so
# to add to start up
vi /etc/rc.local
# add following line
/usr/local/sbin/vsftpd &

Reference : ftp://vsftpd.beasts.org/users/cevans/untar/vsftpd-2.2.0/INSTALL
Why Vsftp: Its fast and secure!

No comments: