Another tool for file synchronization, FTP
FTP service under Ubuntu 1. Configure related services Start the service: [root@netseek root]# #rpm –qa | grep vsftpd ; check whether the vsftpd service is installed #/etc/init.d/vsftpd start ; start the service #chkconfig vsftpd on ; let system services start with system startup Configuration related documents: #vi /etc/vsftpd/vsftpd.conf Disable anonymous user access: anonymous_enable=YES, change YES to NO Add the following settings at the end of the file: # new added by netseek listen_port=5021 ; command channel port, default is 21 listen_data_port=5020 ; data channel port, default is 20 pasv_enable=YES ; Enable passive mode pasv_min_port=10000 ; passive mode uses port range pasv_max_port=10010 local_max_rate=200000 ; user bandwidth limit chroot_local_user=YES ; disable user from leaving home directory listen_address=192.168.0.21 ; let him listen on ip: 192.168.0.21 Note: Please do not add ";" and these Chinese comments in the process of adding, here I added it for the convenience of everyone's understanding. 2. Add virtual host user Add user netseek_com, specify the user directory as /var/www/netseek.com, and this user cannot log in to the system. #mkdir /var/www/netseek.com #useradd –s /sbin/nologin –d /var/www/netseek.com netseek_com The problem is here, after using this sentence, you can’t log in. If you change it to useradd -s /bin/false, then you can Note -s /sbin/nologin is to prevent it from logging in to the system, -d is to specify the user directory as /var/www/netseek.com #passwd netseek_com (Do not Hack me 3ks) DnHm3ks This is the password I set #chown –R netseek_com:netseek_com /var/www/netseek.com Note: Set the ownership and group of the user directory and its subdirectories to netseek_com 3. Configure Disk Quotas During the installation process, I created multiple partitions on the disk, namely /home, /var,/, /www, tmp, swap, and /boot. It is recommended that you divide the disk into multiple separate partitions, which can reduce the risk of data loss caused by disk partition damage. # [root @ netseek root] # rpm -qa | grep quota quota-3.06-9 ; my system has disk quota tools installed #vi /etc/fstab find similar LABEL=/var /var ext3 defaults 1 2 Add usrquota after defaults and change it to the following: LABEL=/var /var ext3 defaults,usrquota 1 2 Reload the /var partition: #mount –o remount /var #cd /var into this directory #touch quota.user #chmod 600 quota.user #quotacheck –mf /var Force detection of disk partition space usage [root@localhost var]# quotacheck -mf /var quotacheck: WARNING - Quotafile /var/quota.user was probably truncated. Can't save quota settings... reboot the system This warning will appear the first time you run it, but not when you run it again. Quota for a given user: #edquota netseek_com Set disk quota for user netseek_com. Disk quotas for user netseek_com (uid 501): Filesystem blocks soft hard inodes soft hard /dev/sda5 6616 307200 0 15 0 0 Note: ilesystem blocks soft hard inodes soft hard filesystem - the filesystem being set up, do not modify or delete bolock - the currently used bump space, the unit is KB soft (first) - soft disk space limit, the default is 0, which means unlimited, I set it to 300M here. hard (first) - hard quota limit, 0 means no limit. inodes - the current number of files soft (second) - soft limit on the number of files, 0 means no limit hard (second) - hard limit on the number of files, 0 means no limit Let the system start to be loaded automatically: #vi /etc/rc.d/rc.local , add the following: /etc/init.d/vsftpd start /sbin/quotacheck /sbin/quotaon –avu Now check the disk space usage of the netseek_com user [root@localhost ~]# quota -u netseek_com Disk quotas for user netseek_com (uid 501): Filesystem blocks quota limit grace files quota limit grace /dev/sda5 6616 307200 0 15 0 0 Note: For more quota commands, please use the man command to check it, Uge (VBird) said, we have to learn to find men! 4. Effect demonstration, login demonstration: Four, VsFTPd related configuration details 1. Anonymous user related settings anonymous_enable=YES , change YES to NO, prohibit anonymous users from logging in #non_mkdir_write_enable=YES, remove the # comment to allow anonymous users to create directories #non_upload_enalbe=YES, remove # to allow anonymous users to upload anon_world_readable_only=YES , allows anonymous users to download, the default is prohibited, this can be added by yourself. Anon_other_write_enable=YES, if it is set to YES, in addition to uploading and creating directories, you can also rename and delete files, the default is NO no_anon_password=NO, set it to YES, anonymous users will not query the user password to log in directly. ftp_username=ftp , the account of the anonymous user logging into the system is ftp by default. It is best not to change this item, otherwise improper setting will threaten the security of the system. 2. FTP service port designation listen_port=8021 , the specified command channel is 8021, the default is 21 listen_data_port=8020 , the specified data channel is 8020, the default is 20 3. Upload mode settings pasv_enable=YES , whether to allow passive mode, the default is allowed. pasv_min_port=10000 , specifies the minimum number of ports to open when using passive mode pasv_max_port=10004 , specifies the maximum open port when using passive mode. 4. Vsftp server specified IP address listen_address=192.168.0.21 , specify FTP, IP address Note: The specified IP is only allowed when vsftp is running in standalone mode. If the vsfpd file has been created in the /etc/xinetd.d directory, the disable in the file must be set to yes. 5. Lock the user, prohibit the user from leaving the user's home directory chroot_local_user=YES, set it to YES, it will be locked in the user's home directory, set to NO, you can switch Set the specified user to lock the user home directory: #chroot_list_enable=YES #chroot_list_file=/etc/vsftpd.chroot_list Change it to the following: chroot_list_enable=NO chroot_list_file=/etc/vsftpd/vsftpd.chroot_list Save the above and do the following: #touch /etc/vsftpd/vsftpd.chroot_list #vi /etc/vsftpd/vsftpd.chroot_list , add the user list to this file, such as: netseek_com 6. FTP server flow control max_clients=100 ; The maximum number of connections allowed, defined as 100, the default is 0, the table has no limit max_per_ip=5 ;The number of connections allowed per IP, 0 means there is no limit, it needs to run in independent mode anon_max_rate=50000 ;The maximum bandwidth of anonymous users, the unit is bps local_max_rate=200000 ; system user maximum bandwidth How to limit traffic to specified users? #vi /etc/vsftpd/vsftpd.conf, add a line: user_config_dir=/etc/vsftpd/userconf #touch /etc/vsftpd/userconf/netseek_com Create a netseek_com file for the user netseek_com #vi /etc/vsftpd/userconf/netseek_com add the following local_max_rate=100000 Save and restart the service. 7. Customize the welcome message Directory Description Settings #vi /etc/vsftpd/vsftpd.conf #dirmessage_enable=YES, remove the previous #. Then we customize a .message, write what you want to write, and then copy this file to the home directory of each user, and it's OK. System welcome message settings ftpd_banner=Welcome to ftp.netseek.com , Yeah!!! System welcome message file settings banner_file=/etc/vsftpd/welcome Similar to ftpd_banner, except that banner_file specifies the welcome file.