sudo open -e〜/.bash_profile权限被拒绝mac [英] sudo open -e ~/.bash_profile Permission denied mac

查看:589
本文介绍了sudo open -e〜/.bash_profile权限被拒绝mac的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编辑bash_profile文件,以通过Mac机上的以下命令将路径添加到我的sdk. 须藤触摸〜/.bash_profile;打开-e〜/.bash_profile

I am trying to edit bash_profile file to add path to my sdk through the following command on my mac machine. sudo touch ~/.bash_profile; open -e ~/.bash_profile

它将在TextEdit中打开文件,但不允许我对其进行编辑.虽然我在运行上述命令时已授予超级用户权限和密码.当我尝试对其进行编辑时,它会显示以下消息.

It opens the file in TextEdit but does not allow me to edit it. Though i have given super-user permission and password while running the above command. It is giving me following message when i try to edit it.

您没有文件".bash_profile",也没有写权限. 您可以复制此文档并编辑副本.只有重复项会包含您的更改." 我是Mac的新手.因此,请详细说明您的答案.

"You don’t own the file ".bash_profile" and don’t have permission to write to it. You can duplicate this document and edit the duplicate. Only the duplicate will include your changes." I am new to mac. So please elaborate your answers.

推荐答案

问题是文件不是您的用户所有,而是root所有.您需要将文件的所有者更改为您的用户,然后您可以在不使用sudo的情况下打开和编辑文件:

The problem is that the file isn't owned by your user, but by root. You need to change the owner of the file to your user, then you can open and edit the file without the use of sudo:

sudo chown farheen ~/.bash_profile

这将作为超级用户将文件的所有者改回给您.

This will, as the super-user, change the owner of the file back to you.

这篇关于sudo open -e〜/.bash_profile权限被拒绝mac的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆