我正在运行一个脚本,但有一个不寻常的警告:这是我的控制台中发生的事情
#whoami root #ls -l test.sh -rwxr-xr-x. 1 root root 1894 Feb 2 01:58 test.sh* #./test.sh -bash: ./test.sh: Permission denied
编辑:我的脚本:
#!/bin/bash while read pass port user ip file; do echo "startt------------------------------------" $ip ping $ip -c 4 if [ $? -eq 0 ]; then echo $ip ok... else echo $ip failed... fi echo "finish------------------------------------" $ip done <<____HERE pass 22 root 1.1.1.1 test.txt ____HERE
任何想法? 谢谢
即时猜测它已经与SELINUX做。 您只需inputsestatus即可查看状态
我正在运行/ tmp目录中的脚本,因为您看到ls的结果是:
-rwxr-xr-x. 1 root root 1894 Feb 2 01:58 test.sh*
有. 表示SELinux安全上下文适用于该文件的权限之后。 所以我复制test.sh在其他目录中…
问题解决了
我在一个可执行文件驻留的目录中
ls -l / drwxrwxrwt. 8 root root 1024 Feb 2 07:44 tmp/