rescueshell Start trial

SSH "Bad configuration option": typo or newer option

Bad configuration option means ssh was given a configuration keyword it did not recognise, or would not accept, and it stopped before it started the connection. The keyword usually comes from a client config file or from an -o option. The message comes from the machine you typed the command on, not from the server.

This page describes standard OpenSSH behaviour. The commands are the usual ones, and wording differs between versions, distributions and platforms. We did not run them on your system for this page.

What the message means

/home/you/.ssh/config: line N: Bad configuration option: Hostnme

The name after the last colon is the keyword ssh did not accept, and N stands for a line number. When the keyword comes from a file, the text before it usually names the file and the line. The exact prefix differs between versions, and a keyword given with -o is reported without a file you can open, so do not rely on the prefix being there. ssh may also add a closing line that says it is terminating because of one or more bad configuration options.

There are two common reasons for a keyword to be refused. One is a typo or a wrong name, such as a misspelt Hostname. The other is a real option that exists only in a newer OpenSSH than the one you are running. That second case is common when a config written on one machine is copied onto another that has an older client. Some builds also report a recognised option as unsupported when it was left out of that build; that wording is different and the same checks apply.

This is a different message from the ones that sound alike, so confirm that first:

1. Read the option name, the file and the line

Copy the keyword exactly as printed, including its capital letters. If a file and a line number are shown, open that file at that line. Keywords in a config file are not case sensitive, so the capitals are rarely the problem, but a missing letter, a doubled letter or a keyword split by a space is.

If no file is shown, the keyword probably came from an -o option on the command line, or from a shell alias or script that adds one. Look at the command you ran, and at anything that wraps it.

The ssh -v output reader can check a pasted log for this line. It runs in your browser and sends nothing.

2. Check which ssh you are running

Print the client version:

ssh -V

If the keyword is spelt correctly, compare this version with the one the config was written for. A config copied from a newer machine, a tutorial or a teammate can name an option that this client has never heard of. The manual for your version, man ssh_config, lists the keywords that version knows, so you can check the spelling there.

Running ssh -v shows which config files ssh read before it stopped, which helps when the file that holds the keyword is not the one you expected, for example a file pulled in by an Include line.

ssh -v user@server.example.com

3. Fix it

Pick the case that matches what you found:

Comment out one suspect line at a time by putting # at the start, and run again. If ssh reports a different keyword next, there was more than one, and the message only names one at a time.

4. Check the result without connecting

ssh -G prints the settings ssh would use for a host without connecting. It reads the same client config, so it can fail with the same message until the keyword is fixed. Once it prints, the config is accepted.

ssh -G myserver

The ssh -G output reader shows the main values from a pasted copy.

If the machine is a RescueShell device

A path that starts from the device can avoid a public SSH port. The agent on the device keeps an outbound HTTPS connection to our relay, so reaching a shell does not depend on an inbound port on the device. That needs the agent installed and running first.

It does not repair a local client config that ssh will not accept. If you still use that file for a direct connection, a bad keyword stays a problem for that connection. If a shell does not open once the agent is installed, see the shell does not open.

Try it on one device

The first device is free to try with no card, for 30 days from when it connects, not from when you sign up. Start a trial.