Permission denied when starting .bashrc on ubuntu on windows

Gian-Andrea Heinrich picture Gian-Andrea Heinrich · Mar 9, 2018 · Viewed 9.5k times · Source

I wanted to add a path to my .bashrc file on Ubuntu on Windows. Since then, I get always:

/home/gian1312/.bashrc: Permission denied

I deleted all my changes. It did not help. Then I opened the .profile file to add the path there. --> Now I get:

/home/gian1312/.profile permission denied

I deleted all my changes. All edits were made by Notepad++ in Windows. I am looking for a solution for several days. Probably a reinstallation would help but as long as I do not know the reason I do not want to risk to face the same problem.

Best Regards and thanks a lot
Gian

Answer

Samit picture Samit · Mar 9, 2018

The error simply says that permission denied. Since the question is not completely clear, the following things can be tried:

1) Check the permission of the file ".bashrc" and ".profile" and make sure it is 0644

2) Check the upper level directory permission (here the folder /home/gian1312) and make sure it is 0755.

3) If the first two are fine, then you need to check the permission of the "path" which you are trying to add and it should have enough permissions to be readable by the user "gian1312"

Editing the answer as per the below comment: To change the permissions, please run the below commands:

chmod 0755 /home/gian1312
chmod 0644 /home/gian1312/.bashrc
chmod 0644 /home/gian1312/.profile