Что означает -i в ssh?

Что означает -i в ssh?

Что -iдобавляет тег к такой команде, как:

ssh -i path-to-pem-file ubuntu@ip-address

решение1

Из страницы руководства:

-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.

По сути, это говорит команде SSH посмотреть на файл ключа, который вам нужен для аутентификации на сервере назначения. Если вы используете аутентификацию по ключу и вам предоставили сертификат, это то, где вы хотите его указать. Если вы используете обычную аутентификацию по паролю, проигнорируйте эту опцию.

Также, на будущее, проще гуглить такие вещи. Меньше усилий потратишь, а ответ получишь быстрее.

решение2

Изстраница руководства

-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.

Связанный контент