CentOS6.3 install and set vsftpd and multi-user logon

Source: Internet
Author: User
1. install vsftpd [root @ localhost ~] through yum # Yum-yinstallvsftpd and-y are added because the system prompts that you directly press Y by default. The vsftpd version installed in yum is 2.2.2.
1. install vsftpd [root @ localhost ~] through yum # Yum-y install vsftpd and-y are prompted to press Y by default. The vsftpd version installed in yum is 2.2.2. [Root @ localhost ~] # Service vsftpd status // check the status, which is disabled by default [root @ localhost ~] # Service vsftpd start // enable the vsftpd service 2. set it to boot [root @ localhost ~] # Chkconfig vsftpd on [root @ localhost ~] # Netstat-tl // check whether the ftp port is listening!
3. configure and modify the configuration in/etc/vsftpd. conf; [root @ localhost ~] # Vim/etc/vsftpd. conf use vim to make code coloring easier. It is clearer than vi. Set it as needed. See the following vsftpd. conf configuration instructions. 4. set the vsftp account. If you add an account, you can use this account to log on to the server and use nologin to prohibit FTP accounts from logging on to the server. Run the following command: [root @ localhost ~] # Useradd-d/usr/local/apache/htdocs-s/sbin/nologin: add the user name to the root directory of the ftp account. For example, the following code creates an ftp account ftpuser under the root directory htdocs of the website. [Root @ localhost ~] # Useradd-d/usr/local/apache/htdocs-s/sbin/nologin ftpuser account has been set, but no password has been added to the account. Use passwd to set a password for the account. [Root @ localhost ~] # Passwd ftpuser New password: // enter the password Retype new password: // enter the password again to access vsftpd through the account password. Vsftpd. conf: (The following section is excerpted from the network .) 1) connection to the anonymous server Anonymous_enable = yes (anonymous login allowed) Dirmessage_enable = yes (the directory is displayed when the directory is switched. message content) Local_umask = 022 (local file permission on FTP, default: 077) Connect_form_port_20 = yes (enable data connection on FTP data port) * Xferlog_enable = yes (logs uploaded and downloaded are activated) Xferlog_std_format = yes (using the standard log format) Ftpd_banner = XXXXX (welcome information) Pam_service_name = vsftpd (verification method) * Listen = yes (independent VSFTPD server) * function: you can only connect to the FTP server, but cannot upload or download the server. note: all links related to log welcome information are optional, all accounts with asterisks need to be added, which is the basic option of FTP 2) enable anonymous FTP server Upload permission (see Yes. Generally, the anonymous Upload permission is not enabled.) Anon_upload_enable = yes (open Upload permission) Anon_mkdir_write_enable = yes (you can upload files in this directory when creating a directory) write_enable = yes (allow local users to write) Anon_other_write_enable = yes (an anonymous account can have the permission to delete) 3) enable anonymous server download permission add the following information to the configuration file: anon_world_readable_only = no note: pay attention to the folder attributes. an anonymous account is another (other) user who wants to enable its read/write permissions (R) read and download (W) write, upload (X. If you do not open the FTP directory, you cannot enter 4) connect to the FTP server of a common user Local_enble = yes (the local account can log on) Write_enable = no (the local account has no permission to delete or modify files after login) function: you can use a local account to log on to the vsftpd server and have the permission to download and upload. note: The anonymous server can log on but cannot upload or download the information after the anonymous login is disabled. 5) user login is restricted to other directories. you can only enter its main directory and set all local users to execute chrootChroot_local_user = yes (all local accounts can only be in their own directories) set the specified user to execute chrootChroot_list_enable = yes (the list in the file can be called) Chroot_list_file =/any specified path/vsftpd. chroot_list note: vsftpd. chroot_list is not created and needs to be added by yourself. to control the account, you can directly add an account to the file. 6) restrict local users to access FTPUserlist_enable = yes (use userlist to restrict user access) userlist_deny = no (users in the list are not allowed to access) Userlist_file =/specify the file storage path/(File placement path) Note: enable userlist_enable = yes anonymous account cannot log on to 7) security option Idle_session_timeout = 600 (seconds) (10 minutes after the user's session is idle) Data_connection_timeout = 120 (seconds) (2 minutes after the data connection is idle) Accept_timeout = 60 (seconds) (disconnect the client from idle for 1 minute) Connect_timeout = 60 (seconds) (disconnect again after 1 minute) Local_max_rate = 50000 (bite) (local user transfer rate: 50 K) anon_max_rate = 30000 (bite) (anonymous user transfer rate 30 K) Pasv_min_port = 50000 (change the client data connection port to Pasv_max_port = 60000 between 200 and) Max_clients = (maximum number of FTP connections) max_per_ip = 4 (maximum number of connections per IP) Listen_port = 5555 (data connection from Port 5555) 8) check who logged on to FTP, and kill its process ps-xf | grep ftpkill process no. CentOS vsftpd multi-user configuration 1. install vsftp. This article uses yum to install:
Yum install vsftpd
2. run after installation:
# Service vsftpd restartShutting down vsftpd: [OK] Starting vsftpdforvsftpd: [OK]

3. new system users:
# Useradd-d/home/www.haojifang.cn-s/sbin/nologin haojifang.cn // add new users not to log on to the local machine # chown-R haojifang.cn/home/users/change the permission for the new directory, only haojifang.cn is allowed to access this directory; # chmod 777-R/home/www.haojifang.cn # passwd haojifang.cn // set a password for the user;
Changing passwordforuser haojifang.cn. New UNIX password: bad password: it does not contain enough DIFFERENT charactersRetypenewUNIX password: passwd: all authentication tokens updated successfully.
5. modify vsftpd. conf to prohibit anonymous account login and allow user-created account login:
Vi/etc/vsftpd. conf
Dependencies = NOlocal_enable = YESwrite_enable = YESlocal_umask = keys = YESchroot_list_file =/etc/vsftpd/chroot_listlisten = YESpam_service_name = keys = YES
4. modify/etc/vsftpd/chroot_list and add a haojifang.cn account to allow this account to log on to the FTP server.
5. in linux Shell command mode
# Setsebool ftpd_disable_trans 1 // disable Selinux protection for ftp services; # vi/etc/selinux/configSELINUX = disabled // set this parameter to Disable # SELINUXTYPE = type of policy in use. possible values are: # targeted-Only targeted network daemons are protected. # strict-Full SELinux protection. SELINUXTYPE = targeted
Restart service
# Service vsftpd restartShutting down vsftpd: [OK] Starting vsftpdforvsftpd: [OK]

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.