[SOLVED] Can't ssh to foo on LAN, but foo.example.com works

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
uberamd

[SOLVED] Can't ssh to foo on LAN, but foo.example.com works

Post by uberamd »

I use Linux Mint in a VM on my work computer and for quite some time now I've been using Linux Mint MATE with little issue. I installed a new VM with Linux Mint KDE and while 99.9999% of things are working perfectly awesome there is one thing that isn't working. This is happening while on network: example.com

Problem:

Code: Select all

$ ssh foo
ssh: Could not resolve hostname foo: Name or service not known
However this works perfectly fine:

Code: Select all

$ ssh foo.example.com
Expected Behavior:
Typing ssh foo while on the example.com network, system should know that foo resides on the same network and shouldn't require me to type in the example.com. My MATE install knows I'm on the same network and can properly resolve foo to foo.example.com, ex: ping foo will ping foo.example.com.

I've done lots of searching yet haven't found anything. Also asked on both #linuxmint-help and #kde with no success/replies.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
uberamd

Re: Can't ssh to foo on LAN, need to type ssh foo.example.co

Post by uberamd »

Answered my own question here after some digging.

Turns out you need to create the /etc/resolv.conf file and tell it to search your domain.

Code: Select all

# vim /etc/resolv.conf

---- In the empty resolv.conf file add:
search example.com

---- Restart networking
# /etc/init.d/networking restart
wavespot
Level 2
Level 2
Posts: 94
Joined: Tue Jan 17, 2012 6:44 am

Re: [SOLVED] Can't ssh to foo on LAN, but foo.example.com wo

Post by wavespot »

Your workaround works, but it's hard coded and now, you can't enjoy dynamic configuration made by NetworkManager.

First, you're right, /etc/resolv.conf must exists : but it's a link to /run/resolvconf/resolv.conf. You can re-create it with :

sudo ln -s ../run/resolvconf/resolv.conf /etc/resolv.conf

Then, add your local domain using NetWorkManager in the 'Search Domain' tab.

Just for your information, try ssh foo.local, if this particular machine is a linux (or Mac, don't konw about windows) with multicast DNS activated, it works. No need to add your local domain then.
Locked

Return to “Software & Applications”