【问题标题】:Error when run file createdb.sh when install Hyperledger Explorer安装 Hyperledger Explorer 时运行文件 createdb.sh 时出错
【发布时间】:2020-12-12 19:51:13
【问题描述】:

当我运行 createdb.sh 文件时,出现错误:\

could not change directory to "/root/gopath/src/github.com/hyperledger/fabric/fabric-samples/blockchain-explorer/app/persistence/fabric/postgreSQL/db": Permission denied
psql: error: ./explorerpg.sql: No such file or directory
could not change directory to "/root/gopath/src/github.com/hyperledger/fabric/fabric-samples/blockchain-explorer/app/persistence/fabric/postgreSQL/db": Permission denied
psql: error: ./updatepg.sql: No such file or directory</code>

我按照https://github.com/hyperledger/blockchain-explorer\ 中的说明进行操作 我已完成所有步骤并为 db/ 应用权限

有文件create.sh

和文件夹 db

【问题讨论】:

  • 能以代码的形式准确告诉我使用的命令吗?
  • @myeongkilkim command sudo -u postgres ./createdb.sh after run command chmod -R 775 db/
  • @myeongkilkim 非常感谢你

标签: hyperledger-fabric hyperledger


【解决方案1】:
# this is your command
sudo -u postgres ~~

使用 sudo -u 选项,您可以作为 postgres 用户运行命令。


https://helpmanual.io/help/sudo/

sudo
  -u, --user=user             run command (or edit file) as specified user name
                              or ID

预计 postgres 用户将没有访问 /root 目录的特权。
以下是三种解决方案。

1。更改文件模式位 /root dir

  • 不推荐。
sudo chmod -R 775 /root

2。将 postgres 添加到超级用户组

# ubuntu 18.04
sudo usermod -aG sudo postgres
su - postgres

# centos7
sudo usermod -aG wheel postgres
su - postgres

3。独立划分工作区

  • 在根目录下运行应用程序是危险的,并且与 Linux 用户理念相矛盾。
  1. 在 /home 目录下新建工作区
  2. 为新工作区设置权限
  3. 移动您的应用程序和代码
  4. 向 postgres 授予权限

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-22
    • 1970-01-01
    • 1970-01-01
    • 2018-01-09
    • 2021-08-24
    相关资源
    最近更新 更多