I am using a WSL, ubuntu on windows 10 and I want to set permissions like below but I am receiving an error. Why? How do I fix it?

ubuntu-user@LAPTOP:~$ chmod 400 .ssh/MyKey.pem
chmod: changing permissions of '.ssh/MyKey.pem': Operation not permitted
  • You are probably not the owner of the file. Edit your question and include the output of ls -la ~/.ssh
    – Panki
    Aug 21, 2020 at 13:26

2 Answers 2


You can just use these commands in only one session, every time when you open terminal, you have to enter again. I solved my issue with this way.

sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o metadata
chmod 400 [fileName] or chmod 700 [fileName]

Reference: https://stackoverflow.com/questions/46610256/chmod-wsl-bash-doesnt-work


use sudo chmod 400 .ssh/MyKey.pem

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .