Sorry, your browser cannot access this site
This page requires browser support (enable) JavaScript
Learn more >

最近碰到一个问题,scp 文件上传到服务器没有权限。

scp,rsync

scp 没有权限参数,使用另一个工具 rsync,可以在上传中配置文件权限。

复杂写法

1
2
3
rsync --perms --chmod=u+rwx ./testfile ./testfile2
rsync --perms --chmod=g+rwx ./testfile ./testfile2
rsync --perms --chmod=o+rwx ./testfile ./testfile2

.e. add (+) permissions for user (u), group (g) or other (o) respectively.
Also (a)=all is successful:

简单写法

1
sudo rsync --perms --chmod=a+rwx ./testfile ./testfile2

or

1
sudo rsync --perms --chmod=ugo+rwx ./testfile ./testfile2

文件权限表

最高权限

1
chmod -R 777 dictionary/file

评论