使用 rsync 为所有文件和文件夹设置组
Setting group for all files and folders with rsync
我正在使用 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
这是我最终使用的命令。出于某种原因,我的 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
我正在使用 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
这是我最终使用的命令。出于某种原因,我的 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