容器mkdir: cannot create directory ‘/opt/kafka/bin/../logs’: Permission denied
时间: 2023-08-01 21:06:11 浏览: 175
这个错误提示表明你在创建目录时没有足够的权限。可能是你当前使用的用户没有在该目录下创建文件的权限。
你可以尝试使用 `sudo` 命令来以管理员身份运行你的命令,例如:
```
sudo mkdir /opt/kafka/bin/../logs
```
如果你已经拥有管理员权限,可以检查一下该目录的权限设置是否正确,例如:
```
ls -ld /opt/kafka/bin/../logs
```
如果权限不正确,可以使用 `chmod` 命令来修改目录的权限设置。
相关问题
hadoop3: mkdir: cannot create directory `/usr/local/hadoop/bin/../logs’: Permission denied
这个错误提示是因为你没有在运行 mkdir 命令时加上 sudo 权限,导致没有权限在 /usr/local/hadoop/bin 目录下创建 logs 目录。
你可以尝试使用以下命令来解决这个问题:
```
sudo mkdir -p /usr/local/hadoop/bin/../logs
```
这样就可以创建 logs 目录了。如果还有其他类似的权限问题,也可以使用 sudo 命令来解决。
为什么会这样[user_mongo@nosql01 replicaset]$ cd /opt [user_mongo@nosql01 opt]$ ll total 0 drwxr-xr-x. 3 root root 25 Mar 16 17:08 servers drwxr-xr-x. 2 root root 51 Mar 16 17:10 software [user_mongo@nosql01 opt]$ tar -zxvf /opt/software/mongodb-linux-x86_64-rhel70-4.4.12.tgz -C /opt/servers/mongodb_demo/replicaset/ mongodb-linux-x86_64-rhel70-4.4.12/LICENSE-Community.txt tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/LICENSE-Community.txt: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/MPL-2 tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/MPL-2: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/README tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/README: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/THIRD-PARTY-NOTICES tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/THIRD-PARTY-NOTICES: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/install_compass tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/install_compass: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongo tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongo: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongod tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongod: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongos tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongos: Cannot open: No such file or directory tar: Exiting with failure status due to previous errors [user_mongo@nosql01 opt]$ tar -zcvf /opt/software/mongodb-linux-x86_64-rhel70-4.4.12.tgz -C /opt/servers/mongodb_demo/replicaset/ tar: Cowardly refusing to create an empty archive Try `tar --help' or `tar --usage' for more information.
根据你提供的信息,出现这种情况可能是因为你没有足够的权限在目标文件夹中创建文件。可以尝试以下解决方法:
1.使用sudo命令运行tar命令,以管理员权限运行。例如:sudo tar -zxvf /opt/software/mongodb-linux-x86_64-rhel70-4.4.12.tgz -C /opt/servers/mongodb_demo/replicaset/
2.检查目标文件夹/opt/servers/mongodb_demo/replicaset/的权限是否正确,可以使用ls -l命令查看。如果权限不足,可以使用chmod命令更改目标文件夹的权限。例如:sudo chmod 755 /opt/servers/mongodb_demo/replicaset/
希望以上解决方法能够帮助到你。
阅读全文