Windows Subsystem for Linux lets developrs run Linux environment. You can use your favorite commands from linux such as grep, sed, awk etc. I am using Ubuntu 18 on my Windows 10 machine.
File permissions in linux work in a different way, compared to windows. You need to set it in rwxrwxrwx format. Here r gets a value of 4, w gets a value of 2 and x i.e. execute gets a value of 1, total 7.
If you are trying to using a .pem or .cer file, you will be getting error saying too open permissions. For a .pem or .cer file you should set it to 600 i.e.
If you try to use chmod in the WSL, your permissions won’t take affect on the file. You need to have wsl.conf file in place to retain the permissions set using chmod command.
Step 1: Create wsl.conf file
**sudo nano /etc/wsl.conf**
Add following lines in wsl.conf
Save the file using
**Ctrl + x**
Step 2: Shutdown wsl for the settings to take affect
Open normal command prompt and run
Step 3: Run chmod again to apply the permissions
Open Windows Terminal again and switch to Ubuntu shell.
chmod 600 mykey.pem
Step 4: Verify using
ls -l to verify that permissions are set properly
- Setup WSL on windows
- Reset WSL Distro password
- Get Windows Terminal
- What is Windows Subsystem for Linux?
- Understanding Linux file permissions