Reputation: 1
I am on macos monterey & have the following in my ~/.ssh/config:
Host foo
HostName cyberark.company.com
User user@user#company.com@target_vm
ssh foo
from my terminal has #company.com@target_vm
portion of my User value automatically truncated where as ssh user@user#company.com@[email protected]
works correctly. Seems like everything after # is treated as comments in .ssh/config file. How do I escape # in this file?
Upvotes: 0
Views: 627
Reputation: 41
From SSH Config documentation the character #
is a special character interpreted by ssh:
Empty lines and lines starting with '#' are comments.
You can prevent these behavior from happening by telling explicitly ssh to read litteral characters instead of interpreting them:
\
special characters such as #
and @
(more informations here)'
As mentioned in this answer from Martin Prikryl
Here you may want to try the following in your case:
Host foo
HostName cyberark.company.com
User 'user@user#company.com@target_vm'
or using backslash:
Host foo
HostName cyberark.company.com
User user\@user\#company.com\@target_vm
Upvotes: 0