In vsftpd, there are virtual users (impersonated users customized by the administrator) because it is not safe to use anonymous users and local users. We know that a server based on the SSH protocol must ensure that there is a system of users. When there are many synchronization requirements, it may be necessary to create many users. This obviously does not meet the GNU/Linux operation and maintenance standards (the more users, the more insecure), in rsync, for security reasons, there is an rsync protocol authentication login method.
How to do it?
Just write the corresponding parameters and values in the configuration file. In Rocky Linux 8, you need to manually create the file /etc/rsyncd.conf.
[root@Rocky~]# touch /etc/rsyncd.conf[root@Rocky~]# vim /etc/rsyncd.conf
Some parameters and values of this file are as follows, here has more parameter descriptions:
Item
Description
address = 192.168.100.4
The IP address that rsync listens on by default
port = 873
rsync default listening port
pid file = /var/run/rsyncd.pid
File location of process pid
log file = /var/log/rsyncd.log
File location of the log
[share]
Share name
comment = rsync
Remarks or description information
path = /rsync/
The system path location where it is located
read only = yes
yes means read only, no means read and write
dont compress = *.gz *.gz2 *.zip
Which file types do not compress it
auth users = li
Enable virtual users and define what a virtual user is called. Need to create it yourself
secrets file = /etc/rsyncd_users.db
Used to specify the location of the virtual user's password file, which must end in .db. The content format of the file is "Username: Password", one per line
tip
The permission of the password file must be 600.
Write some file content to /etc/rsyncd.conf, and write the user name and password to /etc/rsyncd_users.db, the permission is 600
You are prompted that the reading error is related to the "read only = yes" of the server . Change it to "no" and restart the service [root@Rocky ~]# systemctl restart rsyncd.service
Our virtual user here is li, which is mapped to the system user nobody by default. Of course, you can change it to other system users. In other words, nobody does not have write permission to the /rsync/ directory. Of course, we can use [root@Rocky ~]# setfacl -mu:nobody:rwx /rsync/ , try again, and succeed.