I'm using an SSH config file with a ProxyCommand to hop through a bastion host to my target host. Specifically, the ProxyCommand uses a cloud service CLI that takes the hostname / user / port I originally passed, looks them up in a database, and connects me to the host through their bastion. It essentially looks like this:

Host host-*
  ProxyCommand /bin/the-cli %h %r %p

The problem is that the database of target hostnames is case-sensitive, i.e. host-XyZ, but SSH always turns the hostname I originally entered (%h) into a lowercase string. So the end result is something like:

$ ssh host-XyZ

Bastion service: there are no targets with name 'xyz'

Can I prevent SSH from doing this? I don't see any documentation of where the remote hostname is being converted to lowercase.

1 Answer 1


Use %n instead. Per ssh_config manual

%n    The original remote hostname, as given on the command line.

OpenSSH lowercases %h, which cannot be disabled.

13f97b228 circa 2014 changed something to do with CanonicalizeHostname and ssh_config parsing. It also does a lowercase on the host string. Presumably to allow case insensitive substitution before resolving names.

DNS is supposed to be more or less case-insensitive, which is why they can away with this.

You must log in to answer this question.

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