a . VSFTPD Description
There are many softwares for implementing FTP service under Linux, the most common ones are vsftpd,wu-ftpd and proftp. VSFTPD is installed by default in Red Hat Enterprise Linux.
Access to the FTP server needs to be verified, only after the relevant authentication of the FTP server, the user can access and transfer files. VSFTPD provides 3 types of FTP logins:
1 , Anonymous ( anonymous account )
The use of Anonymous is a widely used FTP server. If the user does not have an account on the FTP server, the user can log in by using anonymous as their user name and their e-mail address. When an anonymous user logs on to the FTP server, The login directory is the root directory of the anonymous FTP server/VAR/FTP. In order to reduce the load on the FTP server, the upload function of anonymous accounts should normally be turned off.
2 , Real ( Live account )
Real, also known as a local account, is to log in with a real user name and password, but only if the user has his or her own account on the FTP server. After logging in with a real account, the directory is the user's own directory, which is created automatically when the system establishes an account.
3 , Guest ( virtual account )
If the user has an account on the FTP server, but this account can only be used for the file transfer service, then the account is Guest,guest is a form of real accounts, the difference is that geust log on to the FTP server, you cannot access the content other than the host directory.
Second, installation and use
1 , installation FTP Server Tools
Environment is centos6.0, installation of "vsftpd-2.2.2-6.el6.x86_64.rpm"
2 , open vsftp Server Service, check FTP whether the port is open
/ETC/INIT.D/VSFTPD start
Netstat-lpnt | grep vsftpd, you can see that communication is using port 21.
3 , installation FTP Client Tools
The environment is Windows XP and FLASHFXP is installed.
4 , using the download function
On Linux side, Touch/var/ftp/pub/file_linux;
Using FLASHFXP, log on to the server side, use anonymous user access, default access to directory/var/ftp/pub, you can see File_linux, and can be downloaded to the Windows client.
5 , using the upload function
With the Windows client trying to upload files to the Linux/var/ftp/pub directory, the FLASHFXP tool reported the failure message "553 could not create file".
- Modify/etc/vsftpd/vsftpd.conf:
Write_enable=yes
Anon_mkdir_write_enable=yes
Anon_other_write_enable=yes
See http://www.cnblogs.com/hnrainll/archive/2011/02/16/1956538.html For more configuration file parameter descriptions
The Getsebool command can see if the current selinux is prohibited. If not disabled, there are many instructions on how to disable it online.
- Check directory permissions:
Ll/var/ftp
Drwxr-xr-x. 3 root root 4096 June 3 14:51 Pub
Indicates that this directory is currently owned by Root, so the anonymous access user only has Read and Execute permissions and no write permission.
There are two ways to solve this:
A: Set the pub directory to 777 permissions, Chmod-r 777 Pub
B: Create a subdirectory under the pub directory, and set the subdirectory to be the primary FTP user.
First check if the system has FTP users, which are generally created by default.
cat/etc/passwd | grep FTP
Ftp:x:107:65534::/home/ftp:/bin/false
Mkdir/var/ftp/pub/upload
Chown Ftp:root/var/ftp/pub/upload
6 , modify the default root directory.
When the VSFTPD service uses anonymous users to log on, the default root directory is/var/ftp/pub, and the default root directory that is added after the user is logged in may be its home directory (not tried). If you need to set to/MNT/VG, you can add the following:
Anon_root=/var/www/html #针对匿名用户
= = = below for other FTP users, have not tried ==========
Local_root=/var/www/html
Chroot_local_user=yes
Note: (Modify the FTP directory after you also modify the FTP account permissions directory Otherwise there will be no permissions error prompt)
7. Sharing data with SMB
SMB Anonymous users are nobody, so the SMB directory, FTP users cannot write data.
Workaround
- Add FTP to the nobody group, set the group permissions to rwx
- Set the SMB export directory to 777
8 , more examples of use
Http://www.cnblogs.com/hnrainll/archive/2011/02/16/1956536.html
Linux FTP Server Setup and use