First install the vsftpd-2.0.1-5.i386.rpm on the first CD in the Linux Enterprise Edition
#rpm –ivh/media/cdrom/redhat/rpms/vsftpd-3.0.1-5.i386.rpm
Start the VSFTPD service
#service vsftpd Start
Refreshing the firewall
#iptables-F
Such a simple Linux under the FTP has been built!
the next step is to slowly optimize our FTP server :
Experiment One: if I do not allow FTP anonymous login, we can modify the VSFTPD main configuration file to implement
#vi/etc/vsftpd/vsftpd.conf Anonymous_enable=yes changed to Anonymous_enable=no.
Restart VSFTPD!
experiment Two:windows in the FTP server can set the welcome word, the maximum number of connections, then we are in the Linux FTP server settings? Also, we can also vsftpd the main configuration file to implement
# vi/etc/vsftpd/vsftpd.conf
Add Ftpd_banner=welcome to here! at the end That's the welcome word.
Max_clients=100 This means that up to 100 users can access the
Restart VSFTPD!
Experiment Three: if you do not want the user Lilei landing to our FTP site, then I can add the user Lilei to vi/etc/vsftpd.ftpusers restart VSFTPD service can be.
Experiment Four: only allow a user lilei can log on to the FTP server, I can do this:
# vi/etc/vsftpd/vsftpd.conf to the last add 2,
Userlist_deny=no/This list of people do not reject, others refused (including anonymous)
USERLIST_FILE=/ETC/MP/indicate the path to the list
Then: #vi/etc/mp to add the username Lilei
Restart the VSFTPD service!
Do not allow users to Lilei landing, other people can. I can do this:
# vi/etc/vsftpd/vsftpd.conf Add Userlist_deny=no to the top
Change to Userlist_deny=yes/the person in this list refuses and the other person passes.
Restart the VSFTPD service!
Experiment V: Registered users we can give him a high download speed (200k), anonymous user words, give them 20K speed, you can do this:
# vi/etc/vsftpd/vsftpd.conf added at the end
local_max_rate=200000
anon_max_rate=20000
Restart the VSFTPD service!
Experiment VI:Zhangsan, Lisi, Wangwu three users to set them different ftp download speed, I can do this:
# vi/etc/vsftpd/vsftpd.conf to the last add
USER_CONFIG_DIR=/ETC/VSFTPD/Define the user's configuration file
#vi/etc/vsftpd/zhangsan Add the following
Local_max_rate = 3000
#vi/etc/vsftpd/lisi Add the following
Local_max_rate = 30000
#vi/etc/vsftpd/wangwu Add the following
Local_max_rate = 300000
Restart the VSFTPD service!
Experiment VII: How to build a simple virtual user? I just want them to login to FTP, but not to my Linux system, which will ensure the security of the FTP server. You can do this:
Adduser–g Ftp–s/sbin/nolgin User01/directly add User01 user to FTP group,
PASSWD User01/Set password for User01
Experiment VIII: The above mentioned although simple, but still unsafe, there is no other way to create a more secure virtual users? Yes! We can do this:
1, set up a virtual user password library file
#vi Logins.txt Add the following
Zhangsan/user Name
123/Password
Lisi
234
Wangwu
345
2, the production of VSFTPD certification database
#db_load –t–t hash–f logins.txt/etc/vsftpd/vsftpd_logins.db
Change database permissions
#chmod 600/etc/vsftpd/vsftpd_logins.db
3, create the PAM profile required by the virtual user
#vi/etc/pam.d/vsftpd.vu Add the following:
Auth required/lib/security/pam_userdb.so Db=/etc/vsftpd/vsftpd_logins
Account Required/lib/security/pam_userdb.so Db=/etc/vsftpd/vsftpd_logins
4, establish the virtual user and the directory to be accessed and set the appropriate permissions
#useradd-D/home/ftpsite Virtual/System account required to establish VSFTPD virtual users
#chmod 700/home/ftpsite/set permissions for the host directory to 700
5, set the vsftpd.conf configuration file
#vi/etc/vsftpd/vsftpd.conf added as follows:
Guest_enable=yes
Guest_username=virtual
Pan_service_name=vsftpd.vu
Anon_world_readable_only=no
Restart the VSFTPD service!
Experiment Nine: manage virtual users, the requirements are as follows:
WANGWU has access to directory, upload, rename, delete, etc.
Lisi has browse directory, upload, download permissions
Zhangsan has browse directory, download permissions (and only in the/MISC/ABC directory, speed of 20k)
We can do this:
First edit the VSFTPD main configuration file,
#vi/etc/vsftpd/vsftpd.conf added as follows:
USER_CONFIG_DIR=/ETC/VSFTPD/Specifies the location of the virtual user profile
Then meet the needs of Wangwu:
Vi/etc/vsftpd/wangwu Add the following:
Anon_world_readable_only=no//Open Read permission (if not added, the user sees the directory is hidden)
Anon_upload_enable=yes
Anon_mkdir_write_enable=yes
Anon_other_write_enable=yes
Meet the needs of Lisi:
Vi/etc/vsftpd/lisi Add the following:
Anon_world_readable_only=no//Open Read permission (if not added, the user sees the directory is hidden)
Anon_upload_enable=yes
Meet the needs of Zhangsan:
Vi/etc/vsftpd/zhangsan Add the following:
Anon_world_readable_only=no//Open Read permission (if not added, the user sees the directory is hidden)
LOCAL_ROOT=/MISC/ABC//Set directory as Local
anon_max_rate=20000
Finally restart the VSFTPD service!
Experiment x: How to set the permissions that anonymous users can upload and delete
We can do this:
#vi/etc/vsftpd/vsftpd.conf added as follows:
Anon_upload_enable=yes
Anon_mkdir_write_enable=yes
Anon_other_write_enable=yes
#chmod –r 777/var/ftp/pub/permission to change Pub directory
Restart the VSFTPD service.