【问题标题】:Setting group for all files and folders with rsync使用 rsync 为所有文件和文件夹设置组
【发布时间】:2020-11-08 13:34:47
【问题描述】:

我正在使用rsync 将一些文件发送到我的生产服务器,并希望确保组中的所有用户都可以执行部署。

如何确保 rsync 脚本同时设置:

  • 正确的组(www-data)
  • 正确的权限(www-data 组的所有成员的读、写、执行)

到目前为止,命令看起来像这样,并上传文件,并设置我想要的权限。但是,I'm not sure how to set the group for every single file and folder, recursively.

rsync -rvp --chmod=u+rwx,g+rwx,o=rx public/ myuser@123.12.12.123:/var/www/mysite

我读过您可以使用--chown 选项,但这一直给我以下错误:no matches found: --usermap=*:www-data

怎么了?这是我尝试的最后一个命令:

rsync -rv -og --usermap=:www-data --groupmap=:www-data --chmod=u+rwx,g+rwx,o=rx public/ slave:/var/www/mysite.com

【问题讨论】:

  • --chmod 不起作用还是--usermap

标签: linux ssh permissions rsync


【解决方案1】:

这是我最终使用的命令。出于某种原因,我的 shell 正在扩展 --chmod 命令并失败(由于 *)。

rsync -rv -og --usermap="\*:www-data" --groupmap="\*:www-data" --chmod=u+rwx,g+rwx,o=rx public/ myuser@123.12.12.134:/var/www/mysite

【讨论】:

    猜你喜欢
    • 2015-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-04
    • 2018-06-07
    • 2013-04-17
    • 2011-05-15
    • 2017-01-15
    相关资源
    最近更新 更多