first step, installation
1. Download vsftpd.tar.gz from https://security.appspot.com/vsftpd.html;
2. Execute the following command:
TAR-ZXVF vsftpd-xx.tar.gz
CD vsftpd-xx
3. Edit the Makefile file and edit the results as follows:
# Makefile for systems with GNU tools CC = gcc install = Install IFlags =-idirafter Dummyinc #CFLAGS = -G CFLAGS =-o2-fpie-fstack-protector--param=ssp-buffer-size=4 \-wall-w-wshadow-werror-wformat-secu rity \-d_fortify_source=2 \ #-pedantic-wconversion LIBS = './vsf_findlibs.sh ' LINK = -wl,-s ldflags =-fpie-pie-wl,-z,relro-wl,-z,now Objs = main.o utility.o prelogin.o ftpcmdio.o Postlogi N.O privsock.o \ tunables.o ftpdataio.o secbuf.o ls.o \ postprivparent.o logging.o str.o n ETSTR.O sysstr.o strlist.o \ banner.o filestr.o parseconf.o secutil.o \ ascii.o oneprocess.o twoprocess.o privops. o standalone.o hash.o \ tcpwrap.o ipaddrparse.o access.o features.o readwrite.o opts.o \ SSL.O sslslave.o Ptracesa NDBOX.O ftppolicy.o sysutil.o sysdeputil.o \ seccompsandbox.o. C.O: $ (CC)-C $*.c $ (CFLAGS) $ (iflags) vsftp D: $ (OBJS) $ (CC) -O vsftpd $ (OBJS) $ (LINK) $ (ldflags) $ (LIBS) install:if [-x/usr/local/sbin]; Then \ $ (INSTALL)-M 755 vsftpd/usr/local/sbin/vsftpd; \ Else \ $ (INSTALL)-M 755 vsftpd/usr/sbin/vsftpd; fi if [-x/usr/share/man]; Then \ $ (INSTALL)-M 644 Vsftpd.8/usr/share/man/man8/vsftpd.8; \ $ (INSTALL)-M 644 vsftpd.conf.5/usr/share/man/man5/vsftpd.conf.5; \ elif [-x/usr/local/man]; Then \ $ (INSTALL)-M 644 Vsftpd.8/usr/local/man/man8/vsftpd.8; \ $ (INSTALL)-M 644 vsftpd.conf.5/usr/local/man/man5/vsftpd.conf.5; \ Else \ $ (INSTALL)-M 644 Vsftpd.8/usr/man/man8/vsftpd.8; \ $ (INSTALL)-M 644 vsftpd.conf.5/usr/man/man5/vsftpd.conf.5; fi if [-X/ETC/XINETD.D]; Then \ $ (INSTALL)-M 644 xinetd.d/vsftpd/etc/xinetd.d/vsftpd; Fi clean:rm-f *.o *.SWP vsftpd
4. Execute the following command:
Make
ls-l vsftpd
useradd Nobody
mkdir/usr/share/empty
mkdir/var/ftp
useradd-d/var/ftp FTP
chown root.root/var/ftp
chmod og-w/var/ftp
CP vsftpd.conf.5/usr/local/man/man5
CP vsftpd.8/usr/ LOCAL/MAN/MAN8
CP vsftpd/usr/local/sbin/vsftpd make
install
CP vsftpd.conf/etc
5. Start the service, test the login
Start service:
/usr/local/sbin/vsftpd
test logon
ftp localhost
user name ftp, password is empty
Step Two: Modify the port
1. Modify/etc/vsftpd.conf, add at the end:
listen_port=801
Indicates that the port number is modified to 801.
2. Edit the/etc/services file and change "ftp 21/tcp" to "ftp 801/tcp".
3. Restart the FTP service.
Step three: Set Password login
1. Modify the vsftpd.conf to change the Anonymouns=yes to Anonymouns=no
2. useradd-d/var/ftp Test
3. passwd Test
4. Restart VSFTPD
Fourth Step: External network access with firewalls
FTP access includes the request interface and the database connection interface, access to FTP includes PASV and port two ways, we usually use the PASV way, so in addition to exposing the FTP access port (that is, the value of Listen_port), but also need to expose the PASV specified port, Add the following configuration in vsftpd.conf:
listen_port=30
pasv_enable=yes
pasv_min_port=55443
pasv_max_port=55443
Table Red FTP port is 30, the data access port is 55443, external only need to expose these two ports can be used to access the FTP network.