我正在尝试在 WSL 上学习 Linux 基础知识。我尝试更改测试文件的权限,但没有按预期工作。
$ stat test.sh
File: test.sh
Size: 1616 Blocks: 8 IO Block: 4096 regular file
Device: eh/14d Inode: 93168217291239796 Links: 1
Access: (0777/-rwxrwxrwx) Uid: ( 1000/merajmasuk) Gid: ( 1000/merajmasuk)
Access: 2019-11-25 01:42:24.306619600 +0600
Modify: 2019-11-25 01:42:24.306619600 +0600
Change: 2019-11-25 12:44:11.615101900 +0600
Birth: -
$ chmod 444 test.sh
$ stat test.sh
File: test.sh
Size: 1616 Blocks: 8 IO Block: 4096 regular file
Device: eh/14d Inode: 93168217291239796 Links: 1
Access: (0555/-r-xr-xr-x) Uid: ( 1000/merajmasuk) Gid: ( 1000/merajmasuk)
Access: 2019-11-25 01:42:24.306619600 +0600
Modify: 2019-11-25 01:42:24.306619600 +0600
Change: 2019-11-25 12:49:02.544253700 +0600
Birth: -
如您所见,我尝试应用权限 444,但这里应用的是 555。另一个例子,
$ stat test.sh
File: test.sh
Size: 1616 Blocks: 8 IO Block: 4096 regular file
Device: eh/14d Inode: 93168217291239796 Links: 1
Access: (0555/-r-xr-xr-x) Uid: ( 1000/merajmasuk) Gid: ( 1000/merajmasuk)
Access: 2019-11-25 01:42:24.306619600 +0600
Modify: 2019-11-25 01:42:24.306619600 +0600
Change: 2019-11-25 12:49:02.544253700 +0600
Birth: -
$ chmod 711 test.sh
$ stat test.sh
File: test.sh
Size: 1616 Blocks: 8 IO Block: 4096 regular file
Device: eh/14d Inode: 93168217291239796 Links: 1
Access: (0777/-rwxrwxrwx) Uid: ( 1000/merajmasuk) Gid: ( 1000/merajmasuk)
Access: 2019-11-25 01:42:24.306619600 +0600
Modify: 2019-11-25 01:42:24.306619600 +0600
Change: 2019-11-25 12:52:27.316596700 +0600
Birth: -
您再次可以看到,它无法正常工作。
我看了这个问题但它对我没有帮助。我找到了一个类似的邮政(因为我的机器使用 NTFS 分区,并且文件在里面/mnt
)询问Ubuntu但我发现它对我来说太复杂了。