Bird
0
0

How can you configure an SSH config file to use a different private key for hosts matching *.dev.example.com but keep the default key for others?

hard📝 Application Q9 of 15
Linux CLI - SSH and Remote Access
How can you configure an SSH config file to use a different private key for hosts matching *.dev.example.com but keep the default key for others?
ASpecify IdentityFile only in the ssh command, not in config
BSet IdentityFile globally and override with User directive for dev hosts
CAdd a Host entry with pattern '*.dev.example.com' and IdentityFile directive
DUse multiple IdentityFile directives under Host *
Step-by-Step Solution
Solution:
  1. Step 1: Use Host pattern for dev hosts

    Create a Host entry with pattern '*.dev.example.com' to match dev hosts.
  2. Step 2: Specify IdentityFile for dev hosts

    Inside this Host entry, set IdentityFile to the dev key path.
  3. Step 3: Default IdentityFile remains for other hosts

    Other hosts use the global or Host * IdentityFile setting.
  4. Final Answer:

    Add a Host entry with pattern '*.dev.example.com' and IdentityFile directive -> Option C
  5. Quick Check:

    Use Host pattern to set IdentityFile per group [OK]
Quick Trick: Use Host pattern to assign keys per host group [OK]
Common Mistakes:
  • Trying to override IdentityFile with User directive
  • Setting multiple IdentityFile under Host *
  • Not using Host pattern for selective keys

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes