$ | >

Allow to set file permissions on NTFS partitions from WSL

Allow commands like chmod to set file permissions on NTFS partitions. Currently WSL supports a limited one way permission mapping from Windows ACL's to POSIX permissions but it needs to be 2-way. Many basic tasks like using ssh keys or working with git repos require being able to set file permissions. It doesn't even matter that much to which exactly windows ACL certain permissions map as long as they are consistent (e.g. setting perms with chmod and then getting them with stat should result in exact same perms).

This is a followup to this closed issue: https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13309479-emulate-posix-compliant-filesystem-permissions

42 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Roman Semenov shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    6 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • John Summerfield commented  ·   ·  Flag as inappropriate

        I have a different perspective. I have transferred a 2Tb disk of photos from one computer to another. I have tried and tried various incantations of takeown and icalcs with little success. On Linux, it would take seconds plus disk spinning time. WSL seems about the same as Windows, nothing useful happens.

        john@JS:/mnt/d/Pictures$ ls -l 2015/Miscellaneous/
        total 268
        d--x--x--x 1 john john 4096 Jun 27 2015 2015-06-27 14.57.20
        d--x--x--x 1 john john 4096 Dec 9 2015 2015-12-09 14.05.14
        d--x--x--x 1 john john 4096 Dec 9 2015 2015-12-09 14.05.35
        ---------- 1 john john 99328 Dec 9 2015 Miscellaneous.cosessiondb
        ---------- 1 john john 83968 Dec 9 2015 Miscellaneous.cosessiondb.backup
        ---------- 1 john john 84992 Dec 9 2015 Miscellaneous.cosessiondb.backup 1
        d--x--x--x 1 john john 4096 Jun 27 2015 Output
        john@JS:/mnt/d/Pictures$ chmod 630 2015/Miscellaneous/*
        chmod: changing permissions of '2015/Miscellaneous/Miscellaneous.cosessiondb': Permission denied
        chmod: changing permissions of '2015/Miscellaneous/Miscellaneous.cosessiondb.backup': Permission denied
        chmod: changing permissions of '2015/Miscellaneous/Miscellaneous.cosessiondb.backup 1': Permission denied
        john@JS:/mnt/d/Pictures$ ls -l 2015/Miscellaneous/
        total 268
        d--x--x--x 1 john john 4096 Jun 27 2015 2015-06-27 14.57.20
        d--x--x--x 1 john john 4096 Dec 9 2015 2015-12-09 14.05.14
        d--x--x--x 1 john john 4096 Dec 9 2015 2015-12-09 14.05.35
        ---------- 1 john john 99328 Dec 9 2015 Miscellaneous.cosessiondb
        ---------- 1 john john 83968 Dec 9 2015 Miscellaneous.cosessiondb.backup
        ---------- 1 john john 84992 Dec 9 2015 Miscellaneous.cosessiondb.backup 1
        d--x--x--x 1 john john 4096 Jun 27 2015 Output
        john@JS:/mnt/d/Pictures$

      • Leonid Milenky commented  ·   ·  Flag as inappropriate

        Two comments:

        1. chmod and ability to update permissions (writable, executable) is "must have" -- just for normal
        look of the files. To have .txt file executable is completely wrong.
        2. It would be nice to have owner to be 'user' by default, not 'root'. Or at least make chown work.

      • Joseph Orbegoso Pea (Joe Pea) commented  ·   ·  Flag as inappropriate

        It is a pain to make a folder on an NTFS partition with all 777 permissions where chmod and chown doesn't do anything.

        My build tools are having weird bugs due to permissions.

        At least, make chmod work from the perspective of the WSL so it *thinks* a file has permissions and ownership as defined, even if from the windows side nothing seems to have changed. It can be purely virtual and not actually for security.

        Just make it work!

        I loved when I had NTFS-3G and from an actual metal Linux install was able to work with NTFS drives as if they were Linux drives, with ownership and permissions modifiable with chmod and chown. It would just be GREAT to have this in WSL.

      • Adam Taylor commented  ·   ·  Flag as inappropriate

        I would broaden this issue and say that it would be nice if WSL did a bit more to make NTFS files look more "normal" in general. One part of this would be to make chmod do something sensible on NTFS files. Another would be to map NTFS owners to something besides "root" in WSL. I understand it's a hard problem, but this really would make bash more of a replacement for Cygwin, MSYS2, Hamilton C Shell, and other unix-y command lines that were previously available in Windows. Honestly, just changing the default color scheme in bash so that the files in NTFS volumes aren't highlighted in green would be a step in the right direction. The issue https://wpdev.uservoice.com/forums/266908-command-prompt-console-windows-subsystem-for-l/suggestions/20119681-make-the-windows-fs-mounts-under-wsl-have-reasonab seems part-and-parcel of this larger issue.

      • David Beauchesne commented  ·   ·  Flag as inappropriate

        When WSL was first announced, I had great hopes that I would be able to replace Cygwin and use it for git/repo and compiling/linking. Unfortunately, without basic chmod capabilities, that will not happen.
        Please consider offering support for chmod in the future. Until then, WSL is of very limited value to me.

      Feedback and Knowledge Base