lla*_*kin 6 linux rsync permissions
我已经运行了命令
sudo rsync --chmod=a+rwx testfile testfile2
Run Code Online (Sandbox Code Playgroud)
这将创建一个文件,testfile2但它的权限是755 (-rwxr-xr-x)
有人可以解释如何使它具有权限777 (-rwxrwxrwx)吗?
Pyl*_*lsa 12
用
sudo rsync --perms --chmod=777 testfile testfile2
Run Code Online (Sandbox Code Playgroud)
或者
sudo rsync --perms --chmod=a+rwx testfile testfile2
Run Code Online (Sandbox Code Playgroud)
将 --chmod=777 与 rsync 一起使用可能会失败:
sudo rsync --perms --chmod=777 ./testfile ./testfile2
rsync: Invalid argument passed to --chmod (777)
rsync error: syntax or usage error (code 1) at main.c(1453) [client=3.0.9]
Run Code Online (Sandbox Code Playgroud)
但是,这些都是成功的:
sudo rsync --perms --chmod=u+rwx ./testfile ./testfile2
sudo rsync --perms --chmod=g+rwx ./testfile ./testfile2
sudo rsync --perms --chmod=o+rwx ./testfile ./testfile2
Run Code Online (Sandbox Code Playgroud)
即分别为用户 (u)、组 (g) 或其他 (o) 添加 (+) 权限。
另外 (a)=all 是成功的:
sudo rsync --perms --chmod=a+rwx ./testfile ./testfile2
Run Code Online (Sandbox Code Playgroud)
或者:
sudo rsync --perms --chmod=ugo+rwx ./testfile ./testfile2
Run Code Online (Sandbox Code Playgroud)
那 --perms 可以用 -p 替换,结果相同。
撤销 (-) 权限的工作方式相同,甚至是逗号分隔的添加和撤销组合:
sudo rsync --perms --chmod=u-rwx,o+rwx ./testfile ./testfile2
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18105 次 |
| 最近记录: |