I am trying to do SSH localforward port setting in VI config file, so that I can connect Hive server to do some R programming.

Steps followed:

  1. In shell, I configured below in VI config file:
Host bdp-*
UserName a6000

Host bdp-prod
HostName pdl001.na.abc.com
LocalForward 10000:pdl002.na.abc.com:10000
  1. When I do
ssh bdp-prod

I get this error:

ssh: Could not resolve hostname bdp-prod: Name or service not known

I saw couple of similar issues posted here and viewed some blogs related to this setting but couldn’t figure out what is wrong:

ssh: Could not resolve hostname hnname: Name or service not known

OS-windows, ssh version is 4.1. bdp-prod is alias name for the hostname in config file.

  • 1
    What OS are you attempting to do this on? What is bdp-prod? If that is not a hostname that can be resolved on the LAN it needs to be an entry in the /etc/hosts file. – JakeGould Sep 14 '15 at 20:52
  • Following up to @JakeGould, the hostname that needs to be resolvable on your computer is pdl001.na.abc.com. Regardless, unless you have a very different version of ssh, the UserName directive is not valid; should be just User. So, the question remains, what OS and what version of ssh? – crimson-egret Sep 15 '15 at 15:57

I had the config file created at incorrect location. I now created configuration using

vi ~/.ssh/config

with same content as mentioned in question and able to have local port forward work. Thanks for all of your help.

nscd --invalidate=hosts     

worked for me.

  • 1
    Some detail on what this does and why you need to do it would make this a good answer. – Mokubai Nov 2 '15 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.