Centos下诡异的 /bin/bash 问题
今日突然发现某台古董物理机不能ssh远程连接,一直秘密匹配不了:
Permission denied, please try again.
但我确定没有输错密码,还好vnc还能用。。。然后通过vnc 连接到服务器上,本来想通过
service sshd status
看看sshd的状态,但执行执行失败
bash: /sbin/service: /bin/sh: bad interpreter: No such file or directory
然后执行
bash service
service命令正常了,但是
bash service sshd status
还是报错
env: /etc/init.d/sshd: No such file or directory
后来怀疑是不是bash出了问题,最终问题定位:
linux默认是使用/bin/sh来执行我们的shell脚本,而是/bin/sh通常又是软连接至 /bin/bash;
但怪就怪在这台古董物理机 /bin下既没有 sh 也没有 bash 。。。活久见
然后通过
whereis bash
查询发现它在 :
/usr/bin/bash
于是乎:
ln -s /usr/bin/bash /bin/bash
ln -s /usr/bin/bash /binsh
问题解决!以此为戒。。
参考了这位大神的分享:
https://blog.csdn.net/weixin_37981492/article/details/107866450