ssh
デフォルトのディレクトリを無視して実行し.ssh
、他の 1 つまたはより適切に指定された秘密鍵を指定することは可能ですか?
例えば:
ssh --private-key other_id_rsa login@host
ssh
デフォルトのディレクトリを無視して実行し.ssh
、他の 1 つまたはより適切に指定された秘密鍵を指定することは可能ですか?
例えば:
ssh --private-key other_id_rsa login@host
オプションをご利用いただけ-i
ます。
ソース:man ssh
-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 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). ssh will also try to load certificate information from the filename obtained by appending -cert.pub to identity filenames.
アクセスする各ホストに特定の構成を追加することもできます。これは、ssh で使用可能なフラグの使用を永続化するのとほとんど同じです。
利用可能なフラグの全世界があり、提供されるさまざまなサービスの専門化ごとにいくつかのマッピングがあります。あなたの場合、特定のid_rsa
ファイルを使用して、ファイルに書き留めることができ~/.ssh/config
ます。
...
Host host_alias
HostName host_name
IdentityFile ~/.ssh/id_rsa_you_want
...
次に、次のように簡単に使用できます。
ssh host_alias
そしてid_rsa_you_want
が使用されます -- 接続に適用できるその他の構成も同様です。man ssh_config
使用可能なディレクティブの完全なリストについては、を参照してください。