【问题标题】:unable to execute bash command within ubuntu : permissions denied无法在 ubuntu 中执行 bash 命令:权限被拒绝
【发布时间】:2019-07-23 15:16:36
【问题描述】:

无法在 docker 容器中执行 bash :ubuntu

这是我的 bash 脚本(它的调用):

#!/bin/sh

php bin/magento cache:clean
php bin/magento cache:flush

它依次调用这个脚本:

> #!/usr/bin/env php <?php /**  * Copyright © Magento, Inc. All rights reserved.  * See COPYING.txt for license details.  */
> 
> if (PHP_SAPI !== 'cli') {
>     echo 'bin/magento must be run as a CLI application';
>     exit(1); }

这是错误信息:

root@a72397092db6:/var/www/html# ./bins/clean
bash: ./bins/clean: Permission denied
root@a72397092db6:/var/www/html# 

我希望脚本执行。我确实有权执行它。 这是目录的权限。

-rw-r--r--  1 1000 root   68 Jul 23 14:07 clean
-rw-r--r--  1 1000 root  234 Jul 23 14:07 compile
-rw-r--r--  1 1000 root 6148 Jul 23 14:28 .DS_Store
-rw-r--r--  1 1000 root  118 Jul 23 14:07 permissions

【问题讨论】:

标签: linux bash docker operating-system


【解决方案1】:

除非您将其授予自己,否则您无权执行 (x):

chmod +x ./bins/clean

您需要如下所示的权限(前提是您将以 root 的身份运行脚本,因为它在 Docker 中,所以您可能会这样做):

-rwxr--r--  1 1000 root   68 Jul 23 14:07 clean

【讨论】:

    猜你喜欢
    • 2020-02-15
    • 1970-01-01
    • 2018-07-03
    • 1970-01-01
    • 1970-01-01
    • 2019-11-22
    • 1970-01-01
    • 1970-01-01
    • 2023-01-26
    相关资源
    最近更新 更多