bash 在 Windows 上的 ubuntu 上启动 .bashrc 时权限被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49202275/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 16:51:26  来源:igfitidea点击:

Permission denied when starting .bashrc on ubuntu on windows

bashpermissionsdenied.profile

提问by Gian-Andrea Heinrich

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

我想在 Windows 上的 Ubuntu 上添加到我的 .bashrc 文件的路径。从那以后,我总是得到:

/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:

我删除了所有更改。它没有帮助。然后我打开 .profile 文件以在那里添加路径。--> 现在我得到:

/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.

我删除了所有更改。所有编辑均由 Windows 中的 Notepad++ 进行。我正在寻找解决方案好几天。可能重新安装会有所帮助,但只要我不知道原因,我就不想冒险面对同样的问题。

Best Regards and thanks a lot
Gian

最好的问候,非常感谢
吉安

回答by Samit

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

错误只是说permission denied。由于问题不完全清楚,可以尝试以下事情:

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

1) 检查文件“.bashrc”和“.profile”的权限,确定是0644

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

2)检查上层目录权限(这里是文件夹/home/gian1312),确定是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"

3)如果前两个没问题,那么您需要检查您尝试添加的“路径”的权限,并且它应该具有足够的权限以供用户“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