CentOS7.5 ssh服务升级后,sshd服务状态正常,root用户登陆成功
Xshell 7 (Build 0157) Copyright (c) 2020 NetSarang Computer, Inc. All rights reserved. Type `help' to learn how to use Xshell prompt. [C:\~]$ Connecting to 127.0.0.1:XXXXX... Connection established. To escape to local shell, press 'Ctrl+Alt+]'. Warning: The host key of 127.0.0.1 (port: 27159) is not registered. The host key is saved automatically, for you have set the session properties [SSH - Save host key at first connection]. O & M session login successful Last login: Tue May 14 16:26:34 2024 from XXX.XX.XX.XX /bin/bash: Permission denied Connection closed. Disconnected from remote host(root(SSH)@XXX.XX.XXX.XX(XXX.XX.XXX.XX)) at 16:31:15. Type `help' to learn how to use Xshell prompt. [C:\~]$
这个query是一个SSH连接的日志,显示了连接到127.0.0.1:XXXXX的过程。在成功登录后,出现了"/bin/bash: Permission denied"的错误,表示没有权限执行bash命令。最后,连接被关闭。
# 检查 /bin/bash 权限正常
drwxr-xr-x. 14 root root 167 Apr 20 2022 usr
dr-xr-xr-x. 2 root root 28672 May 14 16:46 bin
-rwxr-xr-x. 1 root root 964544 Apr 11 2018 bash
查看/etc/ssh/sshd_config
的参数PermitRootLogin
或PasswordAuthentication
配置
cat /etc/ssh/sshd_config
发现没有以下
PermitRootLogin yes
PubkeyAuthentication yes
PasswordAuthentication yes
追加设置后重启sshd服务,连接成功
标签:bin,Permission,XXX,XX,报错,ssh,root,bash From: https://www.cnblogs.com/hjj1215/p/18191843