I want to connect to my server with OSX from the terminal, but I am getting this error:
me@My-Mac .ssh % ssh -v root@{my_ip_address}
OpenSSH_9.1p1, OpenSSL 1.1.1s 1 Nov 2022
debug1: Reading configuration data /Users/me/.ssh/config
/Users/me/.ssh/config: line 9: Bad configuration option: usekeychain
/Users/me/.ssh/config: line 20: Bad configuration option: usekeychain
/Users/me/.ssh/config: terminating, 2 bad configuration options
As a mobile/front developer, I don't know a lot about SSH and everything related to servers, but FYI I have already added my SSH GitHub and Bitbucket identities (using SourceTree), which seems to be the problem. My .ssh/config file looks like this:
# --- Sourcetree Generated ---
Host XXXX-Bitbucket
HostName bitbucket.org
User XXXX
PreferredAuthentications publickey
IdentityFile /Users/me/.ssh/XXXX-Bitbucket
IgnoreUnknown UseKeychain
UseKeychain yes
AddKeysToAgent yes
# ----------------------------
# --- Sourcetree Generated ---
Host XXXX-GitHub
HostName github.com
User XXXX
PreferredAuthentications publickey
IdentityFile /Users/me/.ssh/XXXX-GitHub
IgnoreUnknown UseKeychain
UseKeychain yes
AddKeysToAgent yes
# ----------------------------
The error specifically points the lines 9 and 20, which correspond to the UseKeychain yes lines.
What should I do? Thank you for your help
Judging from your ssh version string, it looks like you're not using the standard copy of ssh that comes with MacOS.
The "usekeychain" option isn't a standard ssh configuration option. It's specific to the version of ssh included with MacOS. A copy of ssh from some other source may not have the feature, in which case it wouldn't recognize the keyword.
You may be running a version of ssh installed through Homebrew, MacPorts, or some other method. You can determine what copy of ssh you're using by running "which ssh" or "where ssh". The MacOS version is installed as "/usr/bin/ssh"; other versions might be in "/usr/local" or some other place.
One fix would be to use the copy of ssh that comes with MacOS. That copy of ssh should recognize the keyword.
If you want to continue using a different copy of ssh, you could remove the "usekeychain" option from your config, since it's not doing you any good.
If you don't want to remove the option from your config, it looks like you can use the "IgnoreUnknown" option to suppress the warning about the unrecognized "usekeychain" option:
IgnoreUnknown
Specifies a pattern-list of unknown options to be ignored if they are encountered in configuration parsing. This may be used to suppress errors if ssh_config contains options that are unrecognised by ssh(1). It is recommended that IgnoreUnknown be listed early in the configuration file as it will not be applied to unknown options that appear before it.
Adding "IgnoreUnknown UseKeyChain" to the top of your .ssh/config file should suppress the error when you're using a version of ssh that doesn't recognize the option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With