rsync daemon 同步数据时,若想同时指定权限和属主属组,可以做如下配置:

[test1]
uid = admin
gid = admin
incoming chmod = Dug=rwx,Do=rx,Fug=rw,Fo=r
#incoming chmod = D775,F664
outgoing chmod = Du=rwx,Dog=x,Fg=rw,Fog=r
#outgoing chmod = D711,F644
path = /data/backup/test1
hosts allow = 127.0.0.1
auth users = rsy_user
read only = no

该配置可以保证,推向rsync daemon端的文件目录为:admin:admin 775 664

从rsync daemon端拉取的文件目录为: 711 644


另外,rsync推向demo端的文件权限可能也会受到rsync命令参数的影响(v3.1+测试发现)。
例如文件权限为root,rsync使用-a(-o -g保持用户组权限)选项时,会导致收到的权限不符合上面的要求,这时候要去掉-o -g, 例如:rsync -rtlzv

lsyncd里的sync参数不使用archive:

    rsync   = {
       compress = true,
       verbose  = true,
       links    = true,
       times    = true,
       timeout  = 60,
       password_file = "/etc/rsync.pass",
    }

相关文章:

  • 2022-02-20
  • 2022-12-23
  • 2021-04-04
  • 2021-08-06
  • 2021-11-26
  • 2021-06-20
  • 2021-12-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-22
  • 2021-12-14
  • 2021-12-31
  • 2022-01-06
  • 2021-09-19
相关资源
相似解决方案