Minor problem with SSH

When I try to connect to one of my other machines in my home network, I can’t connect using ssh username@hostname. I can however connect with ssh username@hostname.local. My machine names and IP:s are of course added to /etc/hosts.

I get the error message : ssh: Could not resolve hostname einstein: Name or service not known. Einstein is the hostname for one of my machines.

I did not have this problem on Cinnamon, I just switched to KDE yesterday. Does KDE handle these things differently? It is not super important, now that I know that hostname.local is working, but if it can be fixed it would be great.

Can you ping the hostname, or only hostname.local? Is this also the same from other devices, or just your KDE installation?

Ping works the same way, ping einstein.local works, but ping einstein does not.

It seems to work the same way one the other machines, that is .local is required. But I never ssh in that direction, so I do not know if that has changed, or always been that way.

Remmina works the same way too…

Have a look at the corresponding entry in ~/.ssh/known_hosts

.ssh/known_hosts says:

einstein.local ecdsa-sha2-nistp256 ...

I suppose here we are.
Add the same key with ‘einstein’ only and try.

I added the line:

einstein ecdsa-sha2-nistp256 ...

but I still need to use .local when ssh.

If ping is only working for einstein.local then I guess the ssh server is advertising itself as einstein.local? You could also check hostname on the einstein server and see if you can ping einstein from the einstein server. If only einstein.local works, then I think the problem lies with the server and how the hostname is advertised.

It should not be a problem with einstein, I think, it worked fine when my machine had Cinnamon yesterday morning? This problem started after I installed KDE on my main machine yesterday.

Again, not super important problem, using .local works fine. I am mostly curious to why this is and if there is a solution to it. Otherwise I am fine with using .local.

And I should mention that even my server, called server, now requires .local. None of those machines have changed since this problem started.

Does trying to ssh or ping einstein. work? Note the “.”, it is intentional. I have seen this when NetBIOS wasn’t resolving correctly and adding the “.” worked (although that was on Windows). I think this may be related to DNS vs NetBIOS resolution, but I’m by no means an expert here.

Nope, both ssh [username]@einstein. and ping ping einstein. fails…

I’ll see if I can replicate, have been using a home DNS server with my server hostnames all added to that so wouldn’t have noticed if something is different with Manjaro KDE.

Thanks, but don’t mess up your network because of this :slight_smile: Be careful…

I was hoping for a simple solution, like edit /etc/whatever and add .local…

The local Domain is part of mDNS. The lookup is done via Avahi. Many systems support it. Do not create entries with a .local domain, this domain is reserved only for mDNS.

Some basics, which software do you use to lookup DNS. The old way with resolv.conf or systemd-resolved?

Since ssh and also ping would use nsswitch.conf to do lookup stuff, is it correctly configured to use /etc/hosts?

Also the most important question, are you sure the entries in /etc/hosts are correct? Can you give an example. And can you add an bogus entry and test it?

1 Like

everything ending with .local is supplied by avahi.

You should consider using static ip addressing for the host you want to connect to.

Then in your /etc/hosts - associate the IP address with a name of your choice - it doesn’t have to be the same as the machine because host file always takes precedence.

If you really - really want bullet proof local lookup - there is a path which very few know of - it is a path which even Microsoft didn’t use until a few years ago. The now retired product Small Business Server used a .local domain and it created heaps of issues - thankfully the product has been retired.

Follow the path … ➜➜➜➜➜

1 Like

It’s ok, just checked and I can’t seem to replicate. I would double check the hostname on einstein, and also that your client has no mistakes in /etc/hosts. Is the hosts file being correctly used?

edit - looks like xabbu beat me to it!

1 Like

My god, I am stupid sometimes. I wrote hostname ip and not ip hostname. Now I can reach my machines not using .local! I am sorry guys…thanks to all of you…

No worries, glad it’s sorted!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.