ssh: Could not resolve hostname – High Sierra

jrogers63

I'm supporting a coworker who recently upgraded his MacBook Pro to High Sierra from Sierra. He's trying to connect to one of our boxes in the field via ssh. The box in question has an IPv6 address.

The ~/.ssh/config file is empty and the ssh keys haven't changed. The /etc/ssh/ssh_config file is the default installed on the MBP. Dig works just fine and reports the proper IPv6 address of the box. Ping6 also works as expected. He can connect to our in-house git server, which is published via DNS with an IPv4 address, and push/pull without issue.

When I get him to ssh to the box, like so:

ssh user@hostname

The connection fails with:

ssh: Could not resolve hostname [hostname]: nodename nor servname provided, or not known

Adding -vvvv to ssh produces the following output:

ssh -vvvv [hostname]
OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to [hostname] port 22.
ssh: Could not resolve hostname [hostname]: nodename nor servname provided, or not known

If he connects to the appliance using the IPv6 address, the connection succeeds and he can login.

Our DNS servers are properly configured and serving addresses as expected. I'm on an MBP with Sierra and I'm having no issues connecting. Also, our group all uses Macbooks of various vintages and OS flavors (no other High Sierra users) and, so far, he's the only one experiencing this issue.

EDIT: We tried the solution presented here. But, Apple's System Integrity Protection got in the way. I'm not about to turn it off at this point. I'd like to leave that as a last resort.

jrogers63

Here's a work around that helped in this case:

# install openssh from brew
brew install openssh

# /usr/local/sbin shouldn't be writable on High Sierra (by default), 
# so brew will fail to link the ssh binary

brew unlink openssh
ln -s /usr/local/Cellar/openssh/<version of openssh>/bin/ssh /usr/local/bin/ssh

That linked a version of ssh that's usable. My coworker is now able to connect as expected. Since there are now two versions of ssh on his mac, it's important to make sure that the openssh version installed via brew is found on the PATH first, eg.

PATH=/usr/local/bin:/usr/bin

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

SSH host: Could not resolve hostname

Fedora 28 - ssh - Could not resolve hostname

ssh: Could not resolve hostname [hostname]: nodename nor servname provided, or not known

Ubuntu ssh: Could not resolve hostname myserver: Name or service not known

OSX: ssh: Could not resolve hostname: nodename nor servname provided, or not known

ssh: Could not resolve hostname ubuntu: Temporary failure in name resolution

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

"Could not resolve hostname" Ansible

Unable to ssh into Ubuntu 12.04 LTS [could not resolve hostname (hostname): Name or service not known

ssh: Could not resolve hostname git: Name or service not known fatal: Could not read from remote repository

Doing ssh tunnel with Python script. Error: "Could not resolve hostname when trying to open ssh tunnel"

SOCKS5 proxy with username and password – ssh: could not resolve hostname, temporary failure in name resolution

SSH config explanation: Could not resolve hostname: nodename nor servname provided, or not known

Git:Adding error adding a second github account "ssh: Could not resolve hostname github-secondUser"

Using yo angular-fullstack:openshift gives error 'ssh: Could not resolve hostname'

ssh: Could not resolve hostname sama5d27-som1-ek-sd:

Yarn: unable to clone private github repo. ssh: Could not resolve hostname github: nodename nor servname provided, or not known

tramp mode will not work (ssh cannot resolve hostname)?

ssh and GIT: couldn't resolve hostname

Ansible synchronize module delegate_to could not resolve hostname

Sending Emails- Could not resolve hostname "smpt.gmail.com"

MacOS High Sierra - unable to interact with Github via ssh

macOS Sierra - error: The specified item could not be found in the keychain - within ssh

Virtualbox not installing on High Sierra

Is Homebrew ready for High Sierra?

How to resolve warning "Could not match supplied host pattern, ignoring: <machine hostname>?

ssh could not resolve host name for ec2 instance

PHP cannot resolve hostname

Kubernetes - resolve hostname of a service