- App permissions
- File Permissions for WSL
- WSL metadata on Windows files
- File Access Scenarios
- Accessing Files in the Windows drive file system (DrvFS) from Linux
- Reading file permissions from an existing Windows file
- Changing file permissions on an existing Windows file using chmod
- Creating a file in DriveFS
- Which Linux user and Linux group owns the file?
- Accessing Linux files from Windows using \wsl$
- Creating a new file
- Accessing files in the Linux root file system from Linux
- Configuring file permissions
- How permissions are handled when you copy and move files and folders
- Summary
- More information
App permissions
Some apps or games in Microsoft Store are designed to take advantage of specific hardware or software capabilities on your Windows device. A photo app might need to use your phone’s camera, or a restaurant guide might use your location to recommend nearby places.
In Windows 10, use the Privacy page to choose which apps can use a particular feature. Select Start > Settings > Privacy. Select the app (for example, Calendar) and choose which app permissions are on or off.
The Privacy page won’t list apps with permission to use all system resources. You can’t use the Privacy settings to control what capabilities these apps can use. Windows Desktop apps fall under this category.
To see the permissions for an app, go to the app product page in Microsoft Store or online. If you don’t want an app to use any of the features listed, you can choose not to install it.
Here’s more info on what permissions allow an app to do:
Access all your files, peripheral devices, apps, programs, and registry: The app has the ability to read or write to all your files (including documents, pictures, and music) and registry settings, which allows the app to make changes to your computer and settings. It can use any peripheral devices that are either attached or part of your device (such as cameras, microphones, or printers) without notifying you. It also has access to your location, and can use platform features, such as location history, app diagnostics, and more, which are denied to most Store apps. You can’t control most of the permissions for this app in Settings > Privacy. Note that while the app has the ability to access these resources, it might not actually do so. For more info about what the app collects or uses, review the privacy policy of the developer.
Account Info: Access any of your account info.
Allow elevation: Allows the app to run with administrator privileges without prompting the user first.
App diagnostics: Get diagnostic information about other running apps.
Bluetooth: Activate and use any Bluetooth connections between your device and other devices.
Calendar: Access your calendars.
Call history: Access history of phone calls you made on the device, in Skype or other telephony apps.
Contacts: Access your contacts, people, or address book apps.
Custom install actions: Install additional software.
Email: Access your email and account info for your email accounts.
Facial recognition: Activate and use any facial recognition hardware.
File system: Access the files and folders to which you have access and read or write to all your files (including documents, pictures, and music).
Fingerprint reader: Activate and use any fingerprint reader hardware.
Local system services: Install a service on the machine that runs with maximum privileges.
Location: Activate and use the GPS or other location-finding features on your device. Access location data in Maps and other location apps.
Messaging: Access your instant messages and account info.
Microphone: Activate and use the microphone on your device.
Modifiable app: Enable the user to modify the app.
Motion: Activate and use the accelerometer or other motion-sensing feature on your device.
Music library: Access any music files from the Music library on your device.
Near field communications: Activate and use any near field communications (NFC) connections between your device and other devices.
Notifications: Access your notifications, found in action center.
Packaged services: Install a service on the machine.
Package write redirect compatability shim: Allows the app to create, modify or delete files in the app’s install folder.
Pictures library: Access any picture files from the Pictures library on your device.
Tasks: Access your task list in Outlook and other task-tracking apps.
Unvirtualized resources: Write registry entries and files that are not cleaned up on uninstall.
Video library: Access any video files from the Video library on your device.
Voice recognition: Activate and use any voice recognition hardware.
Webcam: Activate and use the camera on your device.
WiFi: Activate and use WiFi connections between your device, the internet, and other devices.
Wired connections: Activate and use any wired connections, including Ethernet, USB, and Serial communications between your device, the internet, and other devices.
File Permissions for WSL
This page details how Linux file permissions are interpreted across the Windows Subsystem for Linux, especially when accessing resources inside of Windows on the NT file system. This documentation assumes a basic understanding of the Linux file system permissions structure and the umask command.
When accessing Windows files from WSL the file permissions are either calculated from Windows permissions, or are read from metadata that has been added to the file by WSL. This metadata is not enabled by default.
WSL metadata on Windows files
When metadata is enabled as a mount option in WSL, extended attributes on Windows NT files can be added and interpreted to supply Linux file system permissions.
WSL can add four NTFS extended attributes:
Attribute Name | Description |
---|---|
$LXUID | User Owner ID |
$LXGID | Group Owner ID |
$LXMOD | File mode (File systems permission octals and type, e.g: 0777) |
$LXDEV | Device, if it is a device file |
Additionally, any file that is not a regular file or directory (e.g: symlinks, FIFOs, block devices, unix sockets, and character devices) also have an NTFS reparse point. This makes it much faster to determine the kind of file in a given directory without having to query its extended attributes.
File Access Scenarios
Below is a description of how permissions are determined when accessing files in different ways using the Windows Subsystem for Linux.
Accessing Files in the Windows drive file system (DrvFS) from Linux
These scenarios occur when you are accessing your Windows files from WSL, most likely via /mnt/c .
Reading file permissions from an existing Windows file
The result depends on if the file already has existing metadata.
DrvFS file does not have metadata (default)
If the file has no metadata associated with it then we translate the effective permissions of the Windows user to read/write/execute bits and set them to the this as the same value for user, group, and other. For example, if your Windows user account has read and execute access but not write access to the file then this will be shown as r-x for user, group and other. If the file has the ‘Read Only’ attribute set in Windows then we do not grant write access in Linux.
The file has metadata
If the file has metadata present, we simply use those metadata values instead of translating effective permissions of the Windows user.
Changing file permissions on an existing Windows file using chmod
The result depends on if the file already has existing metadata.
chmod file does not have metadata (default)
Chmod will only have one effect, if you remove all the write attributes of a file then the ‘read only’ attribute on the Windows file will be set, since this is the same behaviour as CIFS (Common Internet File System) which is the SMB (Server Message Block) client in Linux.
chmod file has metadata
Chmod will change or add metadata depending on the file’s already existing metadata.
Please keep in mind that you cannot give yourself more access than what you have on Windows, even if the metadata says that is the case. For example, you could set the metadata to display that you have write permissions to a file using chmod 777 , but if you tried to access that file you would still not be able to write to it. This is thanks to interopability, as any read or write commands to Windows files are routed through your Windows user permissions.
Creating a file in DriveFS
The result depends on if metadata is enabled.
Metadata is not enabled (default)
The Windows permissions of the newly created file will be the same as if you created the file in Windows without a specific security descriptor, it will inherit the parent’s permissions.
Metadata is enabled
The file’s permission bits are set to follow the Linux umask, and the file will be saved with metadata.
Which Linux user and Linux group owns the file?
The result depends on if the file already has existing metadata.
User file does not have metadata (default)
In the default scenario, when automounting Windows drives, we specify that the user ID (UID) for any file is set to the user ID of your WSL user and the group ID (GID) is set to the principal group ID of your WSL user.
User file has metadata
The UID and GID specified in the metadata is applied as the user owner and group owner of the file.
Accessing Linux files from Windows using \\wsl$
Accessing Linux files via \\wsl$ will use the default user of your WSL distribution. Therefore any Windows app accessing Linux files will have the same permissions as the default user.
Creating a new file
The default umask is applied when creating a new file inside of a WSL distribution from Windows. The default umask is 022 , or in other words it allows all permissions except write permissions to groups and others.
Accessing files in the Linux root file system from Linux
Any files created, modified, or accessed in the Linux root file system follow standard Linux conventions, such as applying the umask to a newly created file.
Configuring file permissions
You can configure your file permissions inside of your Windows drives using the mount options in wsl.conf. The mount options allow you to set umask , dmask and fmask permissions masks. The umask is applied to all files, the dmask is applied just to directories and the fmask is applied just to files. These permission masks are then put through a logical OR operation when being applied to files, e.g: If you have a umask value of 023 and an fmask value of 022 then the resulting permissions mask for files will be 023 .
Please see the Configure per distro launch settings with wslconf article for instructions on how to do this.
How permissions are handled when you copy and move files and folders
This article describes how Windows Explorer handles file and folder permissions in different situations.
Original product version: В Windows 10 — all editions, Windows Server 2012 R2
Original KB number: В 310316
Summary
In Microsoft Windows 2000, in Windows Server 2003, and in Windows XP, you have the option of using either the FAT32 file system or the NTFS file system. When you use NTFS, you can grant permissions to your folders and files to control access to those objects. When you copy or move a file or folder on an NTFS volume, how Windows Explorer handles the permissions on the object varies, depending on whether the object is copied or moved within the same NTFS volume or to a different volume.
More information
By default, an object inherits permissions from its parent object, either at the time of creation or when it is copied or moved to its parent folder. The only exception to this rule occurs when you move an object to a different folder on the same volume. In this case, the original permissions are retained.
Additionally, note the following rules:
The Everyone group is granted Allow Full Control permissions to the root of each NTFS drive.
Deny permissions always take precedence over Allow permissions.
Explicit permissions take precedence over inherited permissions.
If NTFS permissions conflict, for example, if group and user permissions are contradictory, the most liberal permissions take precedence.
Permissions are cumulative.
To preserve permissions when files and folders are copied or moved, use the Xcopy.exe utility with the /O or the /X switch.
The object’s original permissions will be added to inheritable permissions in the new location.
To add an object’s original permissions to inheritable permissions when you copy or move an object, use the Xcopy.exe utility with the -O and -X switches.
To preserve existing permissions without adding inheritable permissions from the parent folder, use the Robocopy.exe utility, which is available in the Windows 2000 Resource Kit.
You can modify how Windows Explorer handles permissions when objects are copied or moved to another NTFS volume. When you copy or move an object to another volume, the object inherits the permissions of its new folder. However, if you want to modify this behavior to preserve the original permissions, modify the registry as follows.
This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, see How to back up and restore the registry in Windows.
Click Start, click Run, type regedit in the Open box, and then press ENTER.
Locate and then click the registry key: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer .
On the Edit menu, click Add Value, and then add the following registry value:
- Value name: ForceCopyAclwithFile
- Data type: DWORD
- Value data: 1
Exit Registry Editor.
You can modify how Windows Explorer handles permissions when objects are moved in the same NTFS volume. As mentioned, when an object is moved within the same volume, the object preserves its permissions by default. However, if you want to modify this behavior so that the object inherits the permissions from the parent folder, modify the registry as follows:
Click Start, click Run, type regedit, and then press ENTER.
Locate and then click the registry subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer .
On the Edit menu, click Add Value, and then add the following registry value:
- Value name: MoveSecurityAttributes
- Data type: DWORD
- Value data: 0
Exit Registry Editor.
Make sure that the user account that is used to move the object has the Change Permissions permission set. If the permission is not set, grant the Change Permissions permission to the user account.
The MoveSecurityAttributes registry value only applies to Windows XP and to Windows Server 2003. The value does not affect Windows 2000.