我在尝试使用 SSH 连接到远程服务器时遇到了这个非常奇怪的问题。
我是从命令行执行此操作的,私钥和公钥都位于我的当前目录中。它们分别命名为 id_rsa 和 id_rsa.pub。我已经通过指纹验证它们匹配公钥和私钥。
当我发出以下命令时:
ssh -vT -i ./id_rsa user@remotehost
我收到以下错误:权限被拒绝(公钥)。
但是,如果我将 id_rsa.pub 重命名为其他名称,则可以正常工作。什么可能导致这种情况?是否是远程服务器上的设置导致了这种情况?
当我在同一目录中有 id_rsa.pub 时 -vT 的输出是(并且失败):
OpenSSH_6.1p1, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 50: Applying options for *
debug1: Connecting to remotehost port 22.
debug1: Connection established.
debug1: identity file ./id_rsa type 1
debug1: identity file ./id_rsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu7
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu7 pat OpenSSH_5*
debug1: Enabling …Run Code Online (Sandbox Code Playgroud) ssh ×1