ssh中的-i是什么意思?

sha*_*der 2 ssh command-line

-i标签向命令添加了什么,例如:

ssh -i path-to-pem-file ubuntu@ip-address
Run Code Online (Sandbox Code Playgroud)

The*_*rer 6

从联机帮助页:

-i identity_file
             Selects a file from which the identity (private key) for public
             key authentication is read.  The default is ~/.ssh/identity for
             protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa,
             ~/.ssh/id_ed25519 and ~/.ssh/id_rsa for protocol version 2.
             Identity files may also be specified on a per-host basis in the 
             configuration file.  It is possible to have multiple -i options
             (and multiple identities specified in configuration files).  
             If no certificates have been explicitly specified by the
             CertificateFile directive, ssh will also try to load certificate 
             information from the filename obtained by appending -cert.pub to 
             identity filenames.
Run Code Online (Sandbox Code Playgroud)

基本上,它告诉 SSH 命令查看您在目标服务器上进行身份验证所需的密钥文件。如果您使用密钥身份验证并获得了证书,那么您要在此处指定它。如果您使用普通密码身份验证,请忽略该选项。

此外,对于未来,谷歌这样的事情会更容易。您将花费更少的精力,并更快地得到答案。


Org*_*ble 5

手册页

-i 身份文件

   Selects a file from which the identity (private key) for public
   key authentication is read.  The default is ~/.ssh/identity for
   protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa,
   ~/.ssh/id_ed25519 and ~/.ssh/id_rsa for protocol version 2.
   Identity files may also be specified on a per-host basis in the
   configuration file.  It is possible to have multiple -i options
   (and multiple identities specified in configuration files).  If
   no certificates have been explicitly specified by the
   CertificateFile directive, ssh will also try to load certificate
   information from the filename obtained by appending -cert.pub to
   identity filenames.
Run Code Online (Sandbox Code Playgroud)