Was bedeutet -i in ssh?

Was bedeutet -i in ssh?

Was -ifügt das Tag einem Befehl wie diesem hinzu:

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

Antwort1

Aus der Manpage:

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

Im Grunde weist es den SSH-Befehl an, die Schlüsseldatei zu prüfen, die Sie zur Authentifizierung auf dem Zielserver benötigen. Wenn Sie eine Schlüsselauthentifizierung verwenden und ein Zertifikat erhalten haben, müssen Sie es hier angeben. Wenn Sie eine normale Kennwortauthentifizierung verwenden, ignorieren Sie diese Option.

Außerdem ist es für die Zukunft einfacher, solche Dinge zu googeln. Sie haben weniger Aufwand und erhalten schneller eine Antwort.

Antwort2

Von demmanpage

-i Identitätsdatei

   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.

verwandte Informationen