ArticleDirectory
- Download vsftp
- Configure builddefs. h
- Compile vsftp
- Prerequisites for vsftp
- Install vsftp
- Test vsftp
This article describesUbuntu 12.04Environment installation by source code compilationVsftp 2.3.2. For more information about vsftp, see 《Vsftp application in Ubuntu 12.04.
Download vsftp
The official website of vsftp isHttp://vsftpd.beasts.org/But it does not seem to be accessible in China. You can also search for domestic instances by proxy, for exampleWebmaster download.
Download vsftp to the/usr/local/src directory:
CD/usr/local/SRCSudo WgetHTTP://Zj.down.chinaz.com/201101/vsftpd-2.3.2.tar.gz
Sudo tar zxvfVsftpd-2.3.2.tar.gz
Decompress the downloaded file. The decompressed directory is/usr/local/src/vsftpd-2.3.2.
Sudo TarZxvf vsftpd-2.3.2.Tar. Gzcd vsftpd-2.3.2
Configure builddefs. h
Use vsftpBuilddefs. hProcess the configuration information during compilation. The default content of this file is as follows:
# Ifndef vsf_builddefs_h# DefineVsf_builddefs_h# UNDEFVsf_build_tcpwrappers# DefineVsf_build_pam# UNDEFVsf_build_ssl# Endif/* Vsf_builddefs_h */
DefaultBuilddefs. hOnly EnabledPam,TCP_WRAPPERSAndSSHYes. We can adjust these configurations as needed.
Compile vsftp
Use vsftpVsf_findlibs.shScripts to search for related library files. However, because my Ubuntu is a 64-bit versionVsf_findlibs.shThe location defined by the script is different and needs to be modifiedVsf_findlibs.shScript.
View the hardware architecture of your computer:
$Uname-Mx86-64
If the outputX86_64Is a 64-bit platform.
Use vsftpLibpam. SoLibrary, we can useLocateCommand to quickly locate the current Ubuntu library file storage location:
$LocateLibpam/Lib/x86_64-linux-gnu/libpam. So.0/Lib/x86_64-linux-gnu/libpam. So.0.83.0/Lib/x86_64-linux-gnu/libpam_misc.so.0/Lib/x86_64-linux-gnu/libpam_misc.so.0.82.0/Lib/x86_64-linux-gnu/libpamc. So.0/Lib/x86_64-linux-gnu/libpamc. So.0.82.1......
We can see that Ubuntu has moved the location of the library file/Lib/x86_64-linux-gnuDirectory.
Back up firstVsf_findlibs.shAnd then useVI EditorOpen it and use the following command/LibReplace directory with the new/Lib/x86_64-linux-gnuDirectory:
: % S? /Lib /? /Lib/x86_64-linux-gnu /?
Now we can executeMakeCommand to compile vsftp:
Make
Check whether the compilation is successful:
$Ls-L vsftpd-Rwxrwxr-x1Amonest124088June21 09:31Vsftpd
Prerequisites for vsftp
The default vsftp configuration requires"Nobody"Account, run the following command to check whether the account exists:
$ Useradd nobodyuseradd: User'Nobody'Already exists
The default vsftp configuration requires an empty directory"/Usr/share/empty", Run the following command to check whether the directory exists:
Sudo Mkdir/Usr/share/empty
For anonymous FTP, vsftp requires"FTP"Account and a valid home directory.
Sudo Mkdir/Var/FTPSudoUseradd-D/var/FTP FTP
Note: The default owner of the created/var/FTP directory is root. Do not change the owner to FTP, otherwise, the system will prompt "refusing to run with writable Anonymous root" when the client is connected using an FTP account.
Create"FTP", You should usePasswdCommand to modify its password:
Sudo Passwd FTP
Install vsftp
Execute CommandMake installInstallVsftp:
Sudo Make Install
The content processed during installation is defined inMakefileFile:
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/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 ;\ Elif [-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 ;\ Else \ $ (Install) -M644 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) -M644 Xinetd. d/vsftpd/etc/xinetd. d/vsftpd; Fi
If the man directory cannot be found during installation, You can manually create these directories:
Sudo Mkdir/Usr/local/Man/Man5Sudo Mkdir/Usr/local/Man/Man8
The default configuration file is not copied during the installation process. We recommend that you do this:
Sudo CPVsftpd. CONF/etc
Test vsftp
Vsftp can run onStandalone) Can also run inInetd mode (inetd or xinetd). Running vsftp in inetd mode gives more control, such as traffic and connections. Here we simply run vsftp in standalone mode to test whether the installation is successful.
Edit/Etc/vsftpd. confTo ensureListenThe options are enabled:
Listen = Yes
This actually tells vsftp that it is currently running in standalone mode.
Start vsftp:
Sudo/Usr/local/sbin/vsftpd &
Connect to vsftp to test whether it is running properly:
$ FTP Localhostconnected to localhost. 220 (Vsftpd 2.3 . 2 ) Name (localhost: amonest ): FTP 331 Please specify the password. Password: 230 Login successful. Remote system type is Unix. using binary mode to transfer files. FTP > Ls 200 PORT command successful. Consider using PASV. 150 Here comes the directory listing. -RW-r -- 1 0 0 1361 Jun 21 03 : 03 Readme -RW-r -- 1 0 0 112 Jun 21 03 : 03 Readme. Security -RW-r -- 1 0 0 2115 Jun 21 03 : 03 Readme. SSL -RW-r -- 1 0 0 125 Jun 21 03 : 03 Reward 226 Directory send OK. FTP >
The last figure shows how to connect flashfxp to vsftp: