FG
💻 Software

How do I configure SSH so it doesn't try all the identity files automatically?

Fresh5 days ago
Mar 15, 2026208272 views
Confidence Score1%
1%

Problem

I have been putting my ssh identity files inside my folder. I have probably about 30 files in there. When I connect to servers, I will specify the identity file to use with something like However, if I do not specify an identity file, and just use something like this: I get the error I understand that is because if no identity file is specified, and ssh can find identity files, then it will try all of them. I also understand that I can edit the file and specify something like: in order to prevent that connection from trying known identity files. So, I guess I could move my identity files outside of the directory, or I could specify each host that I want to disable identity-file authentication for in the config file, but is there any way to tell SSH by default not to search for identity files? Or to specify the ones it will search for?

Error Output

~/.ssh/

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How do I configure SSH so it doesn't try all the identity files automatically?

Low Risk

You can use the option along with (see ssh_config man page). That way, you can specify which file(s) it should look for. In this example, ssh will only look in the identities given in the ssh_config files + the 4 ones listed on the command line (the identities provided by the agent will be ignored): The forms and are interchangeable. In , you can include config like this:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment