【问题标题】:Cannot run script as root, but permission denied in process without it无法以 root 身份运行脚本,但在没有它的情况下权限被拒绝
【发布时间】:2021-04-28 14:49:12
【问题描述】:

我正在尝试在我的 Ubuntu 机器上安装 Mycroft AI。

如果我运行:bash dev_setup.sh 我得到错误:致命:无法创建'/home/bobo/mycroft-core/.git/index.lock':权限被拒绝

如果我运行 sudo bash dev_setup.sh,我会收到消息:此脚本不应以 root 身份或使用 sudo 运行。 如果您确实需要这样做,请使用 --allow-root 重新运行

如果我运行 bash dev_setup.sh --allow-root,我会收到相同的 Permission denied 错误消息

关于如何让它运行的任何建议

编辑:

问题的前一步:

sudo git clone https://github.com/MycroftAI/mycroft-core.git
Cloning into 'mycroft-core'...
remote: Enumerating objects: 552097, done.
remote: Counting objects: 100% (90/90), done.
remote: Compressing objects: 100% (59/59), done.
remote: Total 552097 (delta 43), reused 64 (delta 31), pack-reused 552007
Receiving objects: 100% (552097/552097), 115.56
Resolving deltas: 100% (542625/542625), done.

【问题讨论】:

  • 然后创建目录并授予权限。
  • 听起来你搞砸了step beforegit clone ... 期间发生了什么?
  • 更新帖子以包含上一步

标签: bash root


【解决方案1】:

执行时不需要使用sudo:

sudo git clone https://github.com/MycroftAI/mycroft-core.git

当你这样做时,目录是用root的权限创建的,当尝试执行脚本bash dev_setup.sh需要root的权限,但脚本不需要这些权限,你需要删除目录并再次尝试执行混帐克隆。然后就可以执行脚本了。

# delete the directory
sudo rm -R mycroft-core
# clone again the repository
git clone https://github.com/MycroftAI/mycroft-core.git
# Move to the directory
cd mycroft-core
# Execute the script
bash dev_setup.sh

【讨论】:

  • 谢谢,是的。我的错误,现在修正了。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-06-29
  • 1970-01-01
  • 2012-05-03
  • 2020-09-10
  • 1970-01-01
相关资源
最近更新 更多