can be useful to restore the permissions on several files in the current directory and all subdirectories, but be aware that this command will revert ALL changes made to all files. You can also do a git checkout - myfile from within WSL, to restore the permissions for that file by checking it out again, but note that this will also revert any other changes made to that file. Just restore the missing execution permission using chmod +x myscript for that file in WSL. If trying to execute the script you will get a Permission denied, and if doing a git diff you will just get a difference in mode: $ git diff When doing git-checkout from a windows tool and a script file is replaced then it might will loose its metadata, which means loosing the execution permission. Scripts does not work after git checkout! It seems like it is not possible anymore to change permissions of files in '/c/Windows/'. Note that all files in '/c/Windows/', '/c/Program Files/' and '/c/Program Files (x86)/' requires the WSL terminal to be started as administrator to be able to modify the permissions. It doesn't seem to be possible to change permissions on files in C:\Windows anymore.Īdd the execution permission for the application: To chmod files in C:\Program Files or C:\Program Files (x86) the WSL terminal must be started using "Run as administrator".To run a Windows application (.exe) you must chmod +x the application.This is what makes permissions work as expected for the Windows filesystem from within WSL instead of every file having the execution bit set, which is really annoying, but there are some caveats. Important! This will make ALL files and directories in /c have 644 as default permissions, meaning that it won't be possible to execute any applications or scripts in the windows drives unless you specifically add the execute permission from within WSL The permissions can be changed by using chmod, which will create metadata for a file containing the modified permissions. The umask=022 option excludes write permission for group/others for files and directories, and the fmask=111 option excludes execution permission for user/group/others for files, making the default mask 644 on all windows drives mounted automatically by WSL. The umask and fmask sets the default values of the permissions on files and directories of mounted windows drives. See Chmod/Chown WSL Improvements for details. The metadata option will make it possible to set the owner and group of files using chown and modify read/write/execute permissions in WSL using chmod. Root = / changes the mount root for windows local drives to '/' instead of the default '/mnt/, so instead of C: mounted at '/mnt/c' it will be mounted at '/c'.Ĭase=off will make all directories created from within WSL to be case insensitive in the windows file system, because even if Windows is case sensitive the applications run on windows is not necessary case sensitive. Restart all active WSL sessions, can be done from cmd or PS using the command wsl -shutdown. Options = "metadata,umask=022,fmask=111,case=off " In WSL, create (or edit) the file /etc/wsl.conf: But don't allow password authentication, just use pubkey authentication. However, if you enable access to your WSL via SSH and allow password authentication then your WSL password strength will be of importance. And you could simply just log on to the wsl instance as root using wsl -u root. The password you use in WSL is not critical for security since you still need to log on to your windows account to start WSL so it can be an easy to remember password. Password in windows does not change your password in WSL, or vice versa. The user name and password in WSL have nothing to do with the Windows user name and password, so changing your The password can be anything but you must remember it since it will be used when sudo-ing. When selecting a WSL user name you don't need to use the same name as your windows logon. Important! Start WSL once directly after installing the distribution of choise to finish the installation.įor full details see. Enable-WindowsOptionalFeature -Online -FeatureName Microsoft -Windows -Subsystem -Linuxĭownload and install a distro from Windows Store, Command-Line or manually unpack and install (for Windows Server).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |