gpt4 book ai didi

linux - 无法在ubuntu中执行bash命令: permissions denied

转载 作者:太空宇宙 更新时间:2023-11-04 05:41:11 25 4
gpt4 key购买 nike

无法在 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

最佳答案

您没有执行 (x) 的权限,除非您将这些权限授予自己:

chmod +x ./bins/clean

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

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

关于linux - 无法在ubuntu中执行bash命令: permissions denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57167353/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com