使用宝塔终端提示“不支持的身份验证类型: Bad authentication type; allowed types: ['gssapi-keyex', 'gssapi-with-mic', 'password'”的解决方法
在使用宝塔面板(BT Panel)进行操作时,如果遇到错误信息“Bad authentication type; allowed types: ['gssapi-k']”,这通常意味着你在尝试使用SSH连接服务器时,使用了不被服务器支持的认证类型。这个问题经常出现在尝试使用SSH密钥或密码进行连接时,但配置或服务器端设置不正确。
解决方案
1.检查SSH配置:
首先,确保你的SSH服务器的配置文件(通常是 /etc/ssh/sshd_config
)中的 AuthenticationMethods
和 PasswordAuthentication
、PubkeyAuthentication
等选项设置正确。例如,如果你想要同时支持密码和密钥认证,你的配置应该类似这样:
PasswordAuthentication yes
PubkeyAuthentication yes
# 如果你想要限制使用特定的密钥,可以设置AuthorizedKeysFile
# AuthorizedKeysFile .ssh/authorized_keys
2.重启SSH服务
修改配置后,重启SSH服务:
sudo systemctl restart sshd
注意:如果你只想使用密钥认证,可以设置:
PasswordAuthentication no
PubkeyAuthentication yes