如何解决 root 登录我的服务器的问题

如何解决 root 登录我的服务器的问题

在我的 IP 中,我有一个 root 用户和相应的密码。使用此凭据,我从 ftp 客户端登录。

从前两天开始,它就被陌生人攻击了,我无法使用 ftp 客户端登录,提示密码不正确。

因此,我在 cpanel 中更改了 root 用户的密码。现在,我从 ftp 客户端进行连接,但看到以下错误。

Status: Connecting to myip...
Response:   fzSftp started, protocol_version=5
Command:    open "root@myip" 22
Error:  Disconnected: No supported authentication methods available (server sent: publickey,gssapi-keyex,gssapi-with-mic)
Error:  Could not connect to server
Status: Waiting to retry...
Status: Connecting to myip...
Response:   fzSftp started, protocol_version=5
Command:    open "root@myip" 22
Error:  Disconnected: No supported authentication methods available (server sent: publickey,gssapi-keyex,gssapi-with-mic)
Error:  Could not connect to server

我之前在 cpanel 中创建了 SSH 密钥,启用授权并下载密钥,然后尝试使用该密钥在 ftp 客户端中登录。但也没有成功。

然后我禁用授权并删除密钥。

我仍然无法使用 ftp 客户端以 root 用户身份登录。但我可以登录http://我的ip:2086/使用此凭证。

我现在需要做什么?

答案1

攻击者显然已经禁用这两项服务的密码登录。

a) 如果您的服务器有可用的 KVM,您应该能够使用它来恢复攻击者的更改。要重新启用密码登录,您需要修改配置文件并重新启动服务(ssh、ftp)。

b) 如果您在攻击之前在 cpanel 中创建了 SSH 密钥 - 那么攻击者可能已经从 ~/.ssh/authorized_keys 中删除了您的公钥。创建新的密钥对,授权并重试。

c) 如果您已经测试过,请验证您确实使用 ssh 客户端发送了正确的身份(参数 -i '/path/to/private-key')。

相关内容