为什么 ssh 通过 -i 标志而不是 -F 标志连接?

德米特里·西登科

我使用 Ubuntu 16.04。

我想通过单独的配置文件建立到亚马逊服务的 ssh 连接。

此外,我需要将文件从一台服务器传输到另一台服务器,这篇文章建议使用单独的配置文件。

当我使用它时它连接

ssh -i ~/Desktop/ssh_keys/prod.pem ec2-user@***.***.***.***

但当我使用单独的配置时则不然:

ssh -F ~/Desktop/ssh_keys/scp_config prod

scp_config

Host prod
    HostName ***.***.***.***
    User ec2-user
    CertificateFile ~/Desktop/ssh_keys/prod.pem

调试信息

OpenSSH_7.2p2 Ubuntu-4ubuntu2.8, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /home/user/Desktop/ssh_keys/scp_config
debug1: /home/user/Desktop/ssh_keys/scp_config line 1: Applying options for prod
debug1: Connecting to ***.***.***.*** [***.***.***.***] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: certificate file /home/user/Desktop/ssh_keys/prod.pem type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 174.129.126.138:22 as 'ec2-user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ****************
SHA256: ********************
debug1: Host '***.***.***.*** is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:8
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: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

我的设置有什么问题?

维乔尔

您应该使用 IdentityFile 参数来指定您的私钥。

IdentityFile指定从中读取用户 RSA 身份验证身份的文件。

scp_config:

Host prod
    HostName ***.***.***.***
    User ec2-user
    IdentityFile ~/Desktop/ssh_keys/prod.pem

CertificateFile 指定从中读取用户证书的文件。必须单独提供相应的私钥才能使用此证书从 IdentityFile 指令或 -i 标志到 ssh

IdentityFile 也可以与 CertificateFile 结合使用,以提供身份验证所需的任何证书。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

通过ssh隔离连接

来自分类Dev

预期中的“ -i”标志

来自分类Dev

为什么我必须检查溢出标志是否有符号操作,而不是8086中的进位标志?

来自分类Dev

sed中的“ / i”标志是什么?

来自分类Dev

php CLI模式-f标志

来自分类Dev

尝试通过标志通过RemoteApp使用Chrome

来自分类Dev

Makefile似乎忽略标志。为什么?

来自分类Dev

通过外壳与SSH连接?

来自分类Dev

为什么我无法通过SSH看到我的USB连接的Android设备?

来自分类Dev

为什么不能同时(标志){}结束

来自分类Dev

为什么stm32f10x的编译器标志“ -mcpu = cortex-m3”出错?

来自分类Dev

Apache会以404(而不是403)响应,而忽略F标志

来自分类Dev

'''ssh-keygen'''中的-k标志有什么作用?

来自分类Dev

为什么可以通过CLI而不是通过应用程序连接到MySQL 8?

来自分类Dev

为什么我的MacBook通过扬声器而不是通过连接的耳塞播放启动声音?

来自分类Dev

在通过凭证直接连接到Git存储库时,为什么SSH比HTTPS更安全?

来自分类Dev

为什么我无法通过SSH看到我的USB连接的Android设备?

来自分类Dev

通过DEBUG标志允许printf

来自分类Dev

通过Expect和ssh传递背景标志(&)

来自分类Dev

尝试通过标志通过RemoteApp使用Chrome

来自分类Dev

为什么无法从主机通过Telnet或SSH连接到VMWare guest虚拟机ubuntu?

来自分类Dev

为什么在使用-F / dev / stdin语法时ssh立即断开连接?

来自分类Dev

为什么/ etc / profile检查PS1而不是$-中的-i标志

来自分类Dev

配置中的SSH -D标志

来自分类Dev

为什么通过网络连接而不是ByteArray使用InputStream?

来自分类Dev

为什么服务器未通过SSH /连接到目标服务器

来自分类Dev

为什么Robocopy忽略/ copy标志?

来自分类Dev

为什么在通过 SSH 连接到 docker 容器时,我会在提示符中得到 `$` 而不是 `user@hostname:~$`?我是否以用户身份登录?

来自分类Dev

为什么每次通过 SSH 连接时都需要手动获取 ~/.bashrc ?

Related 相关文章

  1. 1

    通过ssh隔离连接

  2. 2

    预期中的“ -i”标志

  3. 3

    为什么我必须检查溢出标志是否有符号操作,而不是8086中的进位标志?

  4. 4

    sed中的“ / i”标志是什么?

  5. 5

    php CLI模式-f标志

  6. 6

    尝试通过标志通过RemoteApp使用Chrome

  7. 7

    Makefile似乎忽略标志。为什么?

  8. 8

    通过外壳与SSH连接?

  9. 9

    为什么我无法通过SSH看到我的USB连接的Android设备?

  10. 10

    为什么不能同时(标志){}结束

  11. 11

    为什么stm32f10x的编译器标志“ -mcpu = cortex-m3”出错?

  12. 12

    Apache会以404(而不是403)响应,而忽略F标志

  13. 13

    '''ssh-keygen'''中的-k标志有什么作用?

  14. 14

    为什么可以通过CLI而不是通过应用程序连接到MySQL 8?

  15. 15

    为什么我的MacBook通过扬声器而不是通过连接的耳塞播放启动声音?

  16. 16

    在通过凭证直接连接到Git存储库时,为什么SSH比HTTPS更安全?

  17. 17

    为什么我无法通过SSH看到我的USB连接的Android设备?

  18. 18

    通过DEBUG标志允许printf

  19. 19

    通过Expect和ssh传递背景标志(&)

  20. 20

    尝试通过标志通过RemoteApp使用Chrome

  21. 21

    为什么无法从主机通过Telnet或SSH连接到VMWare guest虚拟机ubuntu?

  22. 22

    为什么在使用-F / dev / stdin语法时ssh立即断开连接?

  23. 23

    为什么/ etc / profile检查PS1而不是$-中的-i标志

  24. 24

    配置中的SSH -D标志

  25. 25

    为什么通过网络连接而不是ByteArray使用InputStream?

  26. 26

    为什么服务器未通过SSH /连接到目标服务器

  27. 27

    为什么Robocopy忽略/ copy标志?

  28. 28

    为什么在通过 SSH 连接到 docker 容器时,我会在提示符中得到 `$` 而不是 `user@hostname:~$`?我是否以用户身份登录?

  29. 29

    为什么每次通过 SSH 连接时都需要手动获取 ~/.bashrc ?

热门标签

归档