【问题标题】:Permission Denied on editing .bash_profile?编辑 .bash_profile 的权限被拒绝?
【发布时间】:2016-06-22 05:01:05
【问题描述】:

我正在尝试设置 adb 路径,以便可以从任何目录轻松访问它。要设置路径,我正在尝试编辑 .bash_profile 以插入以下行:

导出 PATH=$PATH:/Users/anshulsinghla/Library/Android/sdk/platform-tools/

我用来打开文件的命令: open -e .bash_profile

但我总是收到提示“您不拥有文件 .bash_profile 并且没有写入权限。您可以复制此文档并编辑副本。只有副本将包含您的变化”。

我尝试使用以下命令检查谁是所有者以及他们拥有什么权限:

ls -la ~ | grep bash

输出:

-rw----- 1 anshulsinghla 员工 6820 Jun 22 10:09 .bash_history

-rw-r--r-- 1 anshulsinghla 员工 659 Jun 22 10:11 .bash_profile

它清楚地表明我是文件的所有者,并且我确实具有读/写权限,但为什么它从不让我编辑文件,请有人帮助我。

谢谢

【问题讨论】:

  • 谁是staff组的成员?
  • 您不知何故不是您自己的主目录的所有者?试试ls -ld ~ 看看它显示了什么。
  • @GordonDavisson drwxr-xr-x+ 29 anshulsinghla 员工 986 Jun 8 23:20 /Users/anshulsinghla
  • 能否请您显示ls -l@ ~ | grep bashid 的输出
  • 好的,我希望当前目录是/Users/anshulsinghla,而不仅仅是anshulsinghla。所有的诊断都在使用~,所以试试open -e ~/.bash_profile

标签: bash macos .bash-profile


【解决方案1】:

所有的诊断都在用~,所以试试:

open -e ~/.bash_profile

我们从中学到了什么?诊断错误时,请始终使用完全相同与错误中使用的文件名相同的文件名。

原始命令并未尝试编辑您的主目录中的.bash_profile,但在 cmets 中,每个人都在查看您的主目录。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-11-08
    • 2014-06-23
    • 2015-03-19
    • 1970-01-01
    • 1970-01-01
    • 2011-12-05
    • 1970-01-01
    • 2015-08-30
    相关资源
    最近更新 更多