I have a problem setting up the SSH service:

SSH: Bad configuration option


  • 1
    Please post the output of the ssh mcfly command as text, not as a screenshot
    – kos
    Commented Apr 16 at 8:29
  • 1
    Remove the usekeychain option from your config file and try again.
    – Jos
    Commented Apr 16 at 10:04
  • 1
    UseKeychain is an option in the OSX implementation I think - if you're trying to write a portable configuration file, you may find the IgnoreUnknown option useful Commented Apr 16 at 12:02

1 Answer 1


I found a solution at: https://vsys.host/how-to/how-to-use-the-ssh-config-file

HOST AND PATTERN MATCHING Sophisticated host and pattern matching in SSH config files allows for efficient management of connections to multiple servers. Using patterns and wildcards, configurations can be applied broadly or excluded for specific hosts, demonstrating the powerful flexibility of SSH config files in managing complex server environments.


Host dev-*
User developer
IdentityFile ~/.ssh/dev_rsa

Host prod-*
User admin
IdentityFile ~/.ssh/prod_rsa
StrictHostKeyChecking yes
UserKnownHostsFile /dev/null

This setup specifies different SSH keys and user names for development (dev-) and production (prod-) environments, showcasing the ability to tailor SSH connections to specific requirements.



The ControlMaster, ControlPath, and ControlPersist parameters are pivotal for reusing SSH connections, minimizing connection times for subsequent sessions.


Host *

 ControlMaster auto
 ControlPath ~/.ssh/sockets/%r@%h-%p
 ControlPersist 600

This configuration enables sharing multiple sessions over a single network connection, improving efficiency, especially in scripts or automated tasks.

CONNECTION RELIABILITY AND RESPONSIVENESS: Adjusting ConnectTimeout and ServerAliveInterval ensures SSH connections are more reliable and responsive under various network conditions.


Host *
 ConnectTimeout 10
 ServerAliveInterval 60
 ServerAliveCountMax 3

These settings help maintain the connection alive or determine faster if the connection has been dropped, improving overall reliability.

ENHANCING SECURITY CONTROLLED USE OF SSH-AGENT: The IdentitiesOnly option restricts SSH to use only specified identities, enhancing security by preventing the misuse of keys managed by ssh-agent.


Host example.com
 IdentitiesOnly yes
 IdentityFile ~/.ssh/specific_key

This ensures that only the specified key is used for connections to example.com, even if other keys are available in ssh-agent.

VISUAL VERIFICATION OF HOST KEYS The VisualHostKey feature offers a visual representation of host keys, aiding in the quick identification of unauthorized changes.


Host *
 VisualHostKey yes

When enabled, SSH displays a visual pattern of the host key fingerprint upon connection, providing an additional layer of security verification.

AUTOMATING SSH CONFIGURATIONS SCRIPTING FOR CONFIGURATION MANAGEMENT Automation through scripting is invaluable for maintaining up-to-date SSH config files, minimizing manual intervention and reducing the risk of errors. Scripts can be designed to dynamically add new hosts or update configurations, ensuring a streamlined and current SSH setup.

Example script snippet for adding a new host:

echo "Host new-server
 HostName new-server.example.com
 User admin
 IdentityFile ~/.ssh/new_server_key" >> ~/.ssh/config

This simple script appends a new host configuration to the user’s SSH config file, showcasing the ease with which SSH configurations can be automated.

  • 3
    I'm failing to see how this list of suggestions would help fixing the problem?
    – kos
    Commented Apr 16 at 8:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .