Tag Archives: rsync

Rsync Real-time Error: rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1052) [sender=3.0.9]

Inotify + Rsync real-time synchronization error reporting

1. Error message

It can be synchronized normally, but the following error message will appear:

[root@192 opt]# ./inotify.sh
rsync: failed to set times on "/." (in wwwroot): Operation not permitted (1)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1052) [sender=3.0.9]

The script file is as follows:

[root@192 opt]# vim /opt/inotify.sh

#!/bin/bash
INOTIFY_CMD="inotifywait -mrq -e modify,create,attrib,move,delete /var/www/html/"
RSYNC_CMD="rsync -azH --delete --password-file=/etc/server.pass /var/www/html/ [email protected]::wwwroot/"
$INOTIFY_CMD | while read DIRECTORY EVENT FILE
##while Determine if monitoring records are received
do
    if [ $(pgrep rsync | wc -l) -le 0 ] ; then
        $RSYNC_CMD
    fi
done

2. Solution

Enter the configuration file of Rsync server and change uid and GID to root;

vi /etc/rsyncd.conf 
uid = root
gid = root

Restart Rsync service

kill $(cat /var/run/rsyncd.pid)
rsync --daemon

Perform real-time synchronization again and run the script

Rsync Error: failed to set times on “xxxx”: Operation not permitted

Today, when we synchronize data, we will prompt Rsync: failed to set times on “XXX”: operation not permitted. Generally speaking, if the server time is not right or the permissions are not set properly, the following script house editor will sort out some information for you

Method 1:

The reason why Rsync: failed to set times on “XXX”: operation not permitted appears is that the folder (or file) XXX has no operation permission. If the user performing synchronization is root, there will not be such a problem. However, Rsync can also synchronize without using root. Even if – O, – G is used, the file users and groups synchronized to the destination folder will become synchronized users, but the file permissions can be retained after using – P. When the destination folder (or file) XXX has been modified so that the owner is not the user of Rsync, even if the permission of XXX is 777, the above error will occur

Method 2:

When I use Rsync to synchronize, there is a synchronization error from my local machine to the remote server machine, which prompts
Rsync: failed to set times on “directory” operation not permitted (1)
where directory is a directory on the remote target server

This problem is because of the uid and GID you specified in the/etc/rsync.conf file. In this way, the owner and group of the directory you want to synchronize the file should be the uid and GID specified in the/etc/rsync.conf file.
in this way, the Rsync: failed to set times on class will not be wrong

Here, the permission of all backup files of my source station is ftpuser. Ftpuser

But the uid and GID configured in/etc/rsyncd.conf on my backup side are all wwwad users

So here I have the above error, so after the uid and GID in/etc/rsyncd.conf are changed to ftpuser, I will not report the above error if I restart sersync

(1) Error in Rsync pushing file to target server before modification:

(2) Go to the target server and check the/etc/rsync.conf file to see what uid and GID are

(3) Then, according to the configuration file, the target directory of the target server, the owner and group of the chown directory

After the above settings, it is OK and the synchronization is normal

Method 3

rsync: failed to set times on “/.” (in module): Operation not permitted (1)

This is rsyncd.conf where read only = no is not OK, because the default value is yes

Method 4: under windows, it is generally caused by the incorrect setting of directory permissions on the server side. In general, svccwrsync users need to join the synchronization directory and give all permissions, or set svccwrsync as administrator permission directly (it is better to prohibit the remote login of svccwrsync user)