How To Force SSH Client To Use Given Private Key ( identity file )

How To Force SSH Client To Use Given Private Key ( identity file )

To force the SSH client to use a specific private key (also known as an "identity file") when connecting to a remote server, you can use the -i option when running the ssh command.

Here's an example of how to use the -i option to specify a private key file:

ssh -i /path/to/private_key user@server
S‮‬ource:www.lautturi.com

Replace /path/to/private_key with the path to the private key file on your local system, and user@server with the user and server information for the remote server.

If you have multiple private keys stored in the ~/.ssh directory on your local system, you can specify which key to use by including the -i option and the filename of the key file. For example:

ssh -i ~/.ssh/id_rsa user@server

This will use the id_rsa key file located in the ~/.ssh directory to authenticate the connection to the remote server.

Created Time:2017-10-28 21:38:52  Author:lautturi