Compile and install vsftpd server of for local user authentication
- 2020-05-12 06:26:49
- OfStack
The Linux vsftpd build installation and configuration allows local users to log in to FTP
1. Download the vsftpd source code
wget https://security.appspot.com/downloads/vsftpd-2.3.4.tar.gz
2. Compile vsftpd source code
A 64 - bit system to perform before you compile cp/lib64 / libcap so. 1 / lib libcap. so. 1 command:
tar xzvf vsftpd-2.3.4.tar.gz
cd vsftpd-2.3.4
make
make install
3. Configure vsftpd
cp vsftpd.conf /etc
cp RedHat/vsftpd.pam /etc/pam.d/ftp
sed i 's/anonymous_enable/#anonymous_enable=YES/g' /etc/vsftpd.conf
sed i 's/#local_enable=YES/local_enable=YES/g' /etc/vsftpd.conf
sed i 's/#write_enable=YES/write_enable=YES/g' /etc/vsftpd.conf
sed i 's/#local_umask=022/local_umask=022/g' /etc/vsftpd.conf
sed i 's/#chroot_local_user=YES/chroot_local_user=YES/g' /etc/vsftpd.conf
4. Start vsftpd and set startup
/usr/local/sbin/vsftpd &
sed -i '$a\/usr/local/sbin/vsftpd &' /etc/rc.d/rc.local
5. Add FTP user (username: ftpuser ftp root /home/wwwroot/ftpuser)
useradd -d /home/wwwroot/ftpuser -g ftp -s /sbin/nologin ftpuser
Local user authentication
(1) download files
wget http://jaist.dl.sourceforge.net/project/buluoos/0.1/src/vsftpd-2.2.2.tar.gz
tar zxvf vsftpd-2.2.2.tar.gz
cd vsftpd-2.2.2
(2) edit program code. Cancel PAM validation by tcp_wrappers validation.
sed -i 's/undef VSF_BUILD_TCPWRAPPERS/define VSF_BUILD_TCPWRAPPERS/g' builddefs.h
sed -i 's/define VSF_BUILD_PAM/undef VSF_BUILD_PAM/g' builddefs.h
(3) installation
make -j 8
(4) add system user "nobody" (this user may already exist)
useradd nobody
(5) create directory "/usr/share/empty" (this directory may already exist)
mkdir /usr/share/empty/
(6) install the vsftpd configuration file and execute the program.
install -m 644 vsftpd.conf /etc/vsftpd.conf
install -m 755 vsftpd /usr/local/sbin/vsftpd
install -m 644 vsftpd.8 /usr/share/man/man8
install -m 644 vsftpd.conf.5 /usr/share/man/man5
(7) edit the configuration file
cat
>
>
/etc/vsftpd.conf
<
<
EOF
anonymous_enable=NO
local_enable=YES
write_enable=YES
tcp_wrappers=YES
EOF
(8) start vsftpd
/usr/local/sbin/vsftpd /etc/vsftpd.conf &
* log in as a system user after installation, preferably one running the WEB server, to avoid modifying the ownership group and permissions after uploading.
* the download address of the installation file is not local. If it is invalid, you can search for the download address by yourself. Other installation steps are not affected.