-bash:script.sh:/usr/bin/ksh:错误的解释器:权限被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35150481/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 14:10:48  来源:igfitidea点击:

-bash: script.sh: /usr/bin/ksh: bad interpreter: Permission denied

linuxbash

提问by Matt Lmn

I have some problems with ksh. Logs says we don't have permission to access to ksh. All rights are 777 and we did the symbolic link into /usr/bin/

我对 ksh 有一些问题。日志说我们无权访问 ksh。所有权限都是 777 并且我们做了符号链接到 /usr/bin/

In /usr/bin :

在 /usr/bin 中:

lrwxrwxrwx  1 root root          8 Feb  2 10:29 ksh -> /bin/ksh

In /bin

在 /bin

lrwxrwxrwx  1 root root      21 Dec 23 11:15 ksh -> /etc/alternatives/ksh

In /etc/alternatives

在 /etc/alternatives

lrwxrwxrwx 1 root root 8 Feb  2 10:01 /etc/alternatives/ksh -> /usr/bin

Did something go wrong during installation ?

安装过程中出了什么问题?

It's quite critical for me, thanks for you help !

这对我来说很重要,谢谢你的帮助!

回答by Istvan

Going through your question:

通过你的问题:

  • having 777 right in any unix system exposes a huge risk, an attacker simply overwrite your executables to include a keylogger for example, so this should be avoided most of the cases. Using 755 is suitable for most of the executables instead.

  • alternatives is a pretty standard linux solution for having more than one alternative for a particular executable in this case ksh

  • I think you have to fix your script by pointing it to either /bin/ksh or /bin/ksh93

  • 在任何 Unix 系统中拥有 777 权限都会带来巨大的风险,攻击者只需覆盖您的可执行文件以包括键盘记录器,因此在大多数情况下应该避免这种情况。使用 755 适用于大多数可执行文件。

  • 替代方案是一种非常标准的 linux 解决方案,在这种情况下,对于特定的可执行文件有多个替代方案 ksh

  • 我认为您必须通过将脚本指向 /bin/ksh 或 /bin/ksh93 来修复脚本

Here is the ksh installation of my system for reference:

下面是我系统的ksh安装,供参考:

[root@ ~]# which ksh
/bin/ksh
[root@ ~]# ls -larth /bin/ksh
lrwxrwxrwx 1 root root 21 Feb  2 10:21 /bin/ksh -> /etc/alternatives/ksh
[root@ ~]# ls -alrth /etc/alternatives/ksh
lrwxrwxrwx 1 root root 10 Feb  2 10:21 /etc/alternatives/ksh -> /bin/ksh93
[root@ ~]# ls -alrth /bin/ksh93
-rwxr-xr-x 1 root root 1.5M Nov  3 14:02 /bin/ksh93

回答by Santosh Garole

Try install ksh utility on your System.
In terminal: yum install ksh---> For Redhat based System.

尝试在您的系统上安装 ksh 实用程序。
在终端中:yum install ksh---> 对于基于 Redhat 的系统。