- 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 do I change folder and file Permissions?
- How to change File and Folder permissions in Windows 10
- How to change File and Folder permissions
- 1] Type of users in Windows & Permissions
- 2] Change File and Folder Permissions which you own in Windows 10
- How to apply the same permission to subfolders and files
- 3] Manage permission when sharing a file or folder with other users
- 4] Change Files and Folders Permissions which you DONT own
- how to change folder and file permissions in windows 10
- Replies (6)
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 do I change folder and file Permissions?
Here are the steps to modify ownership and permissions of folders and files:
1. Right-click the file or folder, click Properties , and then click the Security tab.
2. Click Advanced , and then click the Owner tab.
3. Click Edit , and then do one of the following:
· To change the owner to a user or group that is not listed, click Other users and groups and, in Enter the object name to select (examples) , type the name of the user or group, and then click OK .
· To change the owner to a user or group that is listed, in the Change owner to box, click the new owner.
4. If you want to take ownership of the contents of the folder, select the Replace owner on sub containers and objects check box.
5. Click OK , and then click Yes when you receive the following message:
You do not have permission to read the contents of directory folder name. Do you want to replace the directory permissions with permissions granting you Full Control?
All permissions will be replaced if you click Yes .
Note folder name is the name of the folder that you want to take ownership of.
6. Click OK , and then reapply the permissions and security settings that you want for the folder and its contents.
Additional considerations
· An administrator can take ownership of any file on the computer.
· Assigning ownership of a file or a folder might require you to elevate your permissions using User Access Control.
How to change File and Folder permissions in Windows 10
Every file and folder on Windows 10 has permission attributes. It gives your authority to edit, read, write, execute, and modify it. It is relatively easy to change file and folder permissions in Windows 10. However, it depends on the specific criteria. In this post, we will show how you can change file and folder permissions in Windows 10.
How to change File and Folder permissions
I was talking about individual criteria that you need to meet. Those criteria are user authority or power. If you are an admin user, you can almost change anything in Windows. It includes the ability to modify files that are owned by others. However, if you are standard users, you are limited to changing files that only belong to you. In this post, we will discuss the following:
- Types of Users and Permissions
- Change Files and Folders Permissions which you own
- Manage permission when sharing a file or folder with other users
- Change Files and Folders Permissions which you DON’T own.
While it looks complicated, it is relatively easy to manage permissions. What you need to be careful about is the type of permissions.
1] Type of users in Windows & Permissions
While its not necessary, I think its a good idea that you know about this. There are broadly two types of users— local user accounts and local system accounts.
- Local user accounts include Administrators, Standard users, Child, and Guest account.
- Windows OS manages local System accounts. Accounts with a name such as System, Network service, Local service are all system accounts.
An Administrator can also take over System accounts as well or at least modify the file permissions along with other local user accounts.
Another essential thing, but you should know this. Some of these permissions will not be available for files.
- Full Control
- Modify
- Read and Execute
- List folder contents
- Read
- Write
- Special Permissions
2] Change File and Folder Permissions which you own in Windows 10
This section applies to all kinds of users. As long as you are managing files and folders which you won, there is not much of a problem. But at times, users have experienced that they are not able to edit files that they own or are created by them. Follow the steps to fix those problems.
- Right-click on any folder or file and click on Properties.
- Switch to Security tab, and you should see two sections
- Group or usernames that have an ownership right on that file
- Permissions for the selected user
- If you have trouble editing the file or copying files into that folder, then you need to change the permission. Click on the Edit button.
- It will open another window where you can select a user, and add missing permissions by checking the box against the type of permission.
- Once you are done, click on ok, and then apply the changes.
When changing permission for yourself, it is best to check on the box against Full Control. It will keep you off from any trouble you were having with the file or folder.
How to apply the same permission to subfolders and files
It only makes sense to have full control of all the files and folders inside it. Doing it one by one is cumbersome, and thats where you need to use the Advanced button.
- First, make sure to choose the set of permissions or Full control for the top folder
- Then go back to the Security tab, click on the Advanced button.
- Then select the user, which is yourself, and check the box which says—Replace all child object permission entries with inheritable permission entries from this object.
- Click on Apply and then Ok button.
In simple words, whatever the permission, the object, i.e. User, which in this case is you, will be applied to all files, and subfolders.
3] Manage permission when sharing a file or folder with other users
There can be multiple scenarios here:
- The file can be shared, but it cannot be modified.
- Folders shared with multiple users, but they are not allowed to delete the file or add any file.
- Some users are allowed to modify files while others can have read-only access.
Open the permission window by clicking on the Edit button. Next, select the user for which you want to modify. If the user is not there, you can add a new user by clicking on the Add button. It will open a search window which you can use to find the user. Add when you find it.
Once the user is available, select it and then assign appropriate permission. Select what you want to allow, and what you want to deny. It is how you would assign for yourself, except that you are doing it for some other account.
4] Change Files and Folders Permissions which you DONT own
That is where ownership comes into the picture. If you do not own a folder or someone else has modified files in such a way, then you can change it. However, only an admin user can change it for you.
Follow our detailed guide to learn how to take ownership of files and folders which you don’t own.
It might be too much to grasp for once, but once you are through, there will be no confusion left. I hope you were able to understand it clearly.
PS: Attribute Changer lets you change file & folder attributes in Windows 10 easily.
Date: November 14, 2019 Tags: Files, User Account
how to change folder and file permissions in windows 10
Replies (6)
Thank you for contacting Microsoft Community.
- Are you trying to give permission to particular files and folders?
I suggest you to follow the below step and check if it helps.
- Once you choose the file that you want to give permission, right click on it.
- Click on properties and go to security tab, check whether any permission have been set.
- After you have viewed the permissions that are already set, you can now click on the Advanced Button that is right below the «Permissions for Authenticated Users»
- Once you have clicked Advanced, a box like this should appear, the «Permission Entries» box, which shows all the permissions that are set for the users. Now, after you have spotted the user whose permissions you wish to change, click «Change Permissions.
- Click on the user you would like to edit, and then click the option that says «Change Permissions» which is right below the box.
- Once that is clicked, you are going to get the same box pop up, but this time, you can actually edit the options. You do that by clicking the «Administrators» user again, and this time, you are going to click the «Edit» option.
Hope this information was helpful and do let us know if you need further assistance. We will be glad to assist.
56 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
All boxes are grey . How should I continue ?
80 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
Thank you for contacting Microsoft Community.
- Are you trying to give permission to particular files and folders?
I suggest you to follow the below step and check if it helps.
- Once you choose the file that you want to give permission, right click on it.
- Click on properties and go to security tab, check whether any permission have been set.
- After you have viewed the permissions that are already set, you can now click on the Advanced Button that is right below the «Permissions for Authenticated Users»
- Once you have clicked Advanced, a box like this should appear, the «Permission Entries» box, which shows all the permissions that are set for the users. Now, after you have spotted the user whose permissions you wish to change, click «Change Permissions.
- Click on the user you would like to edit, and then click the option that says «Change Permissions» which is right below the box.
- Once that is clicked, you are going to get the same box pop up, but this time, you can actually edit the options. You do that by clicking the «Administrators» user again, and this time, you are going to click the «Edit» option.
Hope this information was helpful and do let us know if you need further assistance. We will be glad to assist.
this is for a file. how for a folder and ALL subfolders and files
8 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.