0

I'm trying to learn Linux essentials on WSL. I tried to change permission for a test file and it didn't work as I expected.

$ 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: -

As you can see, I tried to apply the permission 444, here 555 was applied. Another example,

$ 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: -

Which, again you can see, doesn't work correctly.

I looked at this question but it didn't help me. I found a similar post (as my machine uses NTFS partition and the file is inside /mnt) on AskUbuntu but I found it too complex for me.

8
  • 1
    Is the file located within the WSL /home or is it under /mnt? Filesystems in WSL1 work a bit differently than in standalone Linux, so anything that mentions "ntfs-3g" does not apply. Nov 25, 2019 at 7:08
  • To elaborate on what @grawity said, check out this answer from simpleuser
    – JW0914
    Nov 25, 2019 at 7:47
  • @grawity it's within /mnt. Nov 25, 2019 at 9:33
  • So, you are trying to imply that there is no way of applying chmod unless I copy the file outside /mnt? Nov 25, 2019 at 9:35
  • 1
    Possible duplicate of Unable to change file permissions on Ubuntu Bash for Windows 10
    – Biswapriyo
    Nov 28, 2019 at 14:38

0

You must log in to answer this question.