我尝试 scp 到不属于我的文件夹。其权限设置为 777,但 scp 告诉我权限被拒绝。当将其父文件夹的权限(仍然不属于我)设置为 777 时,scp 成功完成其任务。为什么?
重现步骤:
me@host1:/tmp$ ls -lah /applis/foo/
drwxr-xr-x 4 you yourgroup 4.0K Jan 25 14:19 .
drwxr-xr-x 4 you yourgroup 4.0K Oct 9 13:27 ..
drwxrwxrwx 2 you yourgroup 4.0K Jan 25 14:19 build
me@host2:/tmp$ scp data.xslx me@host1:/applis/foo/build/
scp: /applis/foo/build/: Permission denied
# What?! I thought it was 777
me@host1:/tmp$ chmod -R 777 /applis/foo/
me@host1:/tmp$ ls -lah
drwxrwxrwx 4 you yourgroup 4.0K Jan 25 14:19 .
drwxr-xr-x 4 you yourgroup 4.0K Oct 9 13:27 ..
drwxrwxrwx 2 you yourgroup 4.0K Jan 25 14:19 build
me@host2:/tmp$ scp data.xslx me@host1:/applis/foo/build/
data.xlsx 100% 1006KB 20.8MB/s 00:00
不确定这是否算数,但该文件夹位于这种类型的分区上:
/dev/mapper/rootvg-root / ext4 rw,relatime,data=ordered 0 0
而我似乎没有遇到这种分区的问题:
/dev/mapper/rootvg-home /home ext4 rw,nosuid,nodev,relatime,data=ordered 0 0