Create a virtual user under vsftp-Linux Enterprise Application-Linux server application information. The following is a detailed description. In RedHat AS4, vsftpd is provided to provide an ftp service for the system. However, you need to make a lot of configuration based on your needs in actual applications. We know that when creating a vsftpd user, we generally set up useradd in linux to access ftp, but sometimes we only want to provide the ftp service, to prevent users from logging on to linux using an ftp account, the general method is to restrict the user's access permissions, but it still cannot prevent users from logging on to the linux system, therefore, a better method is to use virtual users of vsftpd ).
1. Create a virtual user database
# Vi/tmp/logins.txt:
Longyufei
1985731
Liushuai
123456
Virtual user information, format:
<用户名>
<密 码>
(Note that there cannot be spaces before and after !)
2. log on to the system as a root user and create a user database
Create a database file/etc/vsftpd_login.db and change its file attributes:
# Chmod 600/etc/vsftpd_login.db
3. Create a PAM file and tell the system that you want to use your own database.
# Vi/etc/pam. d/ftp. vu
Content:
Auth required/lib/security/pam_userdb.so db =/etc/vsftpd_login
Account required/lib/security/pam_userdb.so db =/etc/vsftpd_login
Tell the system that the new user authorization library is in place.
4. create folders and authorize virtual users
# Useradd-d/ftp-s/sbin/nologin virtual (-d user's home directory. -S: the default shell and virtual username used by the user name)
# Chown-R virtual. virtual/ftp (change/ftp directory user .)
5. Modify the vsftpd. conf file
# Vi/etc/vsftpd. conf, and add it to the end (my configuration only retains the following content ):
Anonymous_enable = NO
Local_enable = YES
Connect_from_port_20 = YES
Listen = YES
Listen_port = 21
Tcp_wrappers = YES
Guest_enable = YES
Guest_username = virtual (all virtual users are equivalent to the permission of the virtual system account)
User_config_dir =/etc/vsftpd/user_config_dir (specify the configuration directory for each virtual user account ,)
Pam_service_name = ftp. vu (to correspond to the PAM file just created)
Local_root =/www (specify the default ftp directory. If not set, the default ftp directory is the default directory of the ftp System Account (see/etc/passwd file content ))
The longyufei user configuration file corresponding to the user_config_dir file:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service