« Back to SSH: Frequently Asked Questions

How to disable the usage of the SSH agent

The ssh command can be instructed to avoid using the SSH agent and its known identities with the -o IdentityAgent=none option. This sets the option IdentityAgent to disable the SSH agent.

Command line usage

To use this option on the command line, specify the setting and set it to no.

ssh -oStrictHostKeyChecking=no user@hostname

Usage in configuration file

This setting can also be configured in /etc/ssh_config to define it as its default. An alternative is to define it per host, in the file in your home directory ~/.ssh/config.

To make it a default, define a generic section at the bottom of your config file.

Host *
    # Only use the Identities that are specified with IdentityFile
    IdentitiesOnly yes
    # Define primary key
    IdentityFile /home/%u/.ssh/id_ed25519
    # Disable entities known to ssh-agent
    IdentityAgent none
    # Avoid password authentication
    PasswordAuthentication no

Other questions related to SSH

Feedback

Is the described answer not working or incorrect, got another tip or question? Share your thoughts!