Authentication 使用私钥进行ssh身份验证时出现问题

Authentication 使用私钥进行ssh身份验证时出现问题,authentication,ssh,rsa,Authentication,Ssh,Rsa,我有一个通过ssh运行远程脚本的脚本。我有远程主机的私有rsa密钥,我在ssh命令中使用它,如下所示: ssh -v -o IdentitiesOnly=yes remoteuser@10.18.66.24 -fN -i config/id_rsa_24 automation_fw/config/testscript.sh 其中,id_rsa_24是10.18.66.24上remoteuser的私钥 下面是详细日志记录的输出: OpenSSH_7.9p1, LibreSSL 2.7.3 deb

我有一个通过ssh运行远程脚本的脚本。我有远程主机的私有rsa密钥,我在ssh命令中使用它,如下所示:

ssh -v -o IdentitiesOnly=yes remoteuser@10.18.66.24 -fN -i config/id_rsa_24 automation_fw/config/testscript.sh
其中,id_rsa_24是10.18.66.24上remoteuser的私钥

下面是详细日志记录的输出:

OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to 10.18.66.24 [10.18.66.24] port 22.
debug1: Connection established.
debug1: identity file config/id_gitlabuser_24 type -1
debug1: identity file config/id_gitlabuser_24-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.1
debug1: match: OpenSSH_8.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 10.18.66.24:22 as 'gitlabuser'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:/Q0kjK8pxCjKKHZBwnyUeTKYoZwXw7qZzzhIwZtsiYA
debug1: Host '10.18.66.24' is known and matches the ECDSA host key.
debug1: Found key in /Users/gitlabuser/.ssh/known_hosts:6
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: config/id_gitlabuser_24  explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: config/id_gitlabuser_24
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,password,keyboard-interactive
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,password,keyboard-interactive
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: No more authentication methods to try.
gitlabuser@10.18.66.24: Permission denied (publickey,password,keyboard-interactive).
All identities removed.
Identity added: config/id_gitlabuser_99 (gitlabuser@bbt-grid-01.local)
About to run ssh
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to 10.18.66.99 [10.18.66.99] port 22.
debug1: Connection established.
debug1: identity file config/id_gitlabuser_99 type -1
debug1: identity file config/id_gitlabuser_99-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.9
debug1: match: OpenSSH_7.9 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 10.18.66.99:22 as 'gitlabuser'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:q4KvznBQoEXaksU7QJMRhwexrp/Iz40RZjxP7A5gwuY
debug1: Host '10.18.66.99' is known and matches the ECDSA host key.
debug1: Found key in /Users/gitlabuser/.ssh/known_hosts:7
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: config/id_gitlabuser_99  explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: config/id_gitlabuser_99
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,password,keyboard-interactive
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,password,keyboard-interactive
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: No more authentication methods to try.
gitlabuser@10.18.66.99: Permission denied (publickey,password,keyboard-interactive).
OpenSSH_7.9p1,LibreSSL 2.7.3 debug1:读取配置数据/etc/ssh/ssh\u config debug1:/etc/ssh/ssh_config第48行:应用* debug1:连接到10.18.66.24[10.18.66.24]端口22。 debug1:已建立连接。 debug1:标识文件配置/id\u gitlab用户\u 24类型-1 debug1:标识文件配置/id\u Gitlab用户\u 24-cert类型-1 debug1:本地版本字符串SSH-2.0-OpenSSH_7.9 debug1:远程协议版本2.0,远程软件版本OpenSSH_8.1 debug1:匹配:OpenSSH_8.1 pat OpenSSH*compat 0x04000000 debug1:正在以“gitlabuser”身份验证到10.18.66.24:22 debug1:SSH2\u MSG\u KEXINIT已发送 debug1:SSH2\u MSG\u KEXINIT已收到 debug1:kex:算法:curve25519-sha256 debug1:kex:主机密钥算法:ecdsa-sha2-nistp256 debug1:kex:server->client cipher:chachacha20-poly1305@openssh.comMAC:压缩:无 debug1:kex:client->server cipher:chachacha20-poly1305@openssh.comMAC:压缩:无 debug1:需要SSH2\u MSG\u KEX\u ECDH\u回复 debug1:服务器主机密钥:ecdsa-sha2-nistp256 SHA256:/Q0KKKK8PXCJKHZBWNYUETKYOZWXW7QZZZHIWZTSIYA debug1:主机“10.18.66.24”已知,并且与ECDSA主机密钥匹配。 debug1:在/Users/gitlabuser/.ssh/known_hosts中找到密钥:6 debug1:在134217728块之后重新键入 debug1:SSH2\u MSG\u已发送新密钥 debug1:应为SSH2\u MSG\u NEWKEYS debug1:SSH2\u MSG\u接收到新密钥 debug1:在134217728块之后重新键入 debug1:将尝试键:config/id\u gitlab用户\u 24显式 debug1:SSH2\u MSG\u EXT\u接收到信息 debug1:kex_输入_外部_信息:服务器信号algs= debug1:SSH2\u消息\u服务\u接收 debug1:可以继续的身份验证:公钥、密码、键盘交互 debug1:下一个身份验证方法:公钥 debug1:正在尝试私钥:config/id\u gitlab用户\u 24 debug1:可以继续的身份验证:公钥、密码、键盘交互 debug1:下一个身份验证方法:键盘交互 debug1:读取\u密码短语:无法打开/dev/tty:未配置设备 debug1:可以继续的身份验证:公钥、密码、键盘交互 debug1:读取\u密码短语:无法打开/dev/tty:未配置设备 debug1:可以继续的身份验证:公钥、密码、键盘交互 debug1:读取\u密码短语:无法打开/dev/tty:未配置设备 debug1:可以继续的身份验证:公钥、密码、键盘交互 debug1:下一个身份验证方法:密码 debug1:读取\u密码短语:无法打开/dev/tty:未配置设备 debug1:可以继续的身份验证:公钥、密码、键盘交互 权限被拒绝,请重试。 debug1:读取\u密码短语:无法打开/dev/tty:未配置设备 debug1:可以继续的身份验证:公钥、密码、键盘交互 权限被拒绝,请重试。 debug1:读取\u密码短语:无法打开/dev/tty:未配置设备 debug1:可以继续的身份验证:公钥、密码、键盘交互 debug1:不再尝试验证方法。 gitlabuser@10.18.66.24:权限被拒绝(公钥、密码、键盘交互)。 删除所有身份。 添加的标识:config/id\u gitlab用户\u 99(gitlabuser@bbt-网格-01。本地) 即将运行ssh OpenSSH_7.9p1,LibreSSL 2.7.3 debug1:读取配置数据/etc/ssh/ssh\u config debug1:/etc/ssh/ssh_config第48行:应用* debug1:连接到10.18.66.99[10.18.66.99]端口22。 debug1:已建立连接。 debug1:标识文件配置/id\u gitlab用户\u 99类型-1 debug1:标识文件配置/id\u gitlab用户\u 99-cert类型-1 debug1:本地版本字符串SSH-2.0-OpenSSH_7.9 debug1:远程协议版本2.0,远程软件版本OpenSSH_7.9 debug1:匹配:OpenSSH_7.9 pat OpenSSH*compat 0x04000000 debug1:正在以“gitlabuser”身份验证到10.18.66.99:22 debug1:SSH2\u MSG\u KEXINIT已发送 debug1:SSH2\u MSG\u KEXINIT已收到 debug1:kex:算法:curve25519-sha256 debug1:kex:主机密钥算法:ecdsa-sha2-nistp256 debug1:kex:server->client cipher:chachacha20-poly1305@openssh.comMAC:压缩:无 debug1:kex:client->server cipher:chachacha20-poly1305@openssh.comMAC:压缩:无 debug1:需要SSH2\u MSG\u KEX\u ECDH\u回复 debug1:服务器主机密钥:ecdsa-sha2-nistp256 SHA256:q4KvznBQoEXaksU7QJMRhwexrp/Iz40RZjxP7A5gwuY debug1:主机“10.18.66.99”已知,并且与ECDSA主机密钥匹配。 debug1:在/Users/gitlabuser/.ssh/known_hosts:7中找到密钥 debug1:在134217728块之后重新键入 debug1:SSH2\u MSG\u已发送新密钥 debug1:应为SSH2\u MSG\u NEWKEYS debug1:SSH2\u MSG\u接收到新密钥 debug1:在134217728块之后重新键入 debug1:将尝试键:config/id\u gitlab用户\u 99显式 debug1:SSH2\u MSG\u EXT\u接收到信息 debug1:kex_输入_外部_信息:服务器信号algs= debug1:SSH2\u消息\u服务\u接收 debug1:可以继续的身份验证:公钥、密码、键盘交互 debug1:下一个身份验证方法:公钥 debug1:正在尝试私钥:config/id\u gitlab用户\u 99 debug1:可以继续的身份验证:公钥、密码、键盘交互 debug1:下一个身份验证方法:键盘交互 debug1:读取\u密码短语:无法打开/dev/tty:未配置设备 debug1:可以继续的身份验证:公钥、密码、键盘交互 debug1:读取\u密码短语:无法打开/dev/tty:未配置设备 debug1:可以继续的身份验证:公钥、密码、键盘交互 debug1:读取\u密码短语:无法打开/dev/tty:未配置设备 debug1:可以继续的身份验证:公钥、密码、键盘交互 debug1:下一个身份验证方法:密码 debug1:读取\u密码短语:无法打开/dev/tty:未配置设备 debug1:可以继续的身份验证:公钥、密码、键盘交互 许可被拒绝,请
debug1: Will attempt key: config/id_gitlabuser_24  explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received