You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SSH认证成功后仍出现/bin/sh: Permission Denied错误的原因咨询

test@2023:~$ ssh root@10.42.0.201

The authenticity of host '10.42.0.201 (10.42.0.201)' can't be established.
ECDSA key fingerprint is SHA256:0TSeay4Ywqc69Inkfk0i/t5lJ8sXKSD/lLM2PuN5/d4.
Are you sure you want to continue connecting (yes/no/[fingerprint])? 
yes
Failed to add the host to the list of known hosts (/home/test/.ssh/known_hosts).
root@10.42.0.201's password: 
/bin/sh: Permission denied
Connection to 10.42.0.201 closed.

问题

执行上述SSH连接操作,完成身份认证后却收到/bin/sh: Permission Denied错误提示,连接随即关闭,请问该问题的原因是什么?


原因分析
  • /bin/sh文件权限异常:目标主机上/bin/sh的权限配置错误,比如被设置为600(仅所有者可读可写),而非正常的755(所有者可执行,其他用户可读可执行),导致root用户无法执行该shell。
  • root用户登录shell配置问题:目标主机/etc/passwd文件中,root用户的登录shell字段可能指向错误路径,或对应文件存在权限问题,使得SSH会话无法启动shell进程。
  • 安全模块拦截:SELinux、AppArmor等主机安全增强模块可能设置了限制规则,即使/bin/sh权限正常,也会阻止root用户执行该shell。
  • 文件系统挂载限制:如果/bin所在分区是以noexec(禁止执行)选项挂载的,该分区内所有可执行文件都无法运行,包括/bin/sh。

内容的提问来源于stack exchange,提问作者Yash Suthar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 09:40:12