Unable to Use Hostname to SSH
-
I know, I know, I shouldn't immediately jump to the forum with a question as my first post... However, I've done about as much as I can up to this point and I was really hoping someone would be able to help me out. My RP has been running great. It's connected to my WiFi and I can SSH into using it's IP address just fine.
I wanted to change the hostname so that I don't always have to remember the IP address. I did it within the raspi-config tool and used the default hostname of retropie. I've looked into my router's settings and it appears that the hostname has been adjusted there as well, so I think that I should be able to SSH into this RP just fine. However, I still can't seem to get this to work.
From within my router, I can see that the hostname is listed:
If I try to ping the RP using the hostname, I get no response. However, if I ping using the IP address, then I receive a response just fine:
I'm certain that the hostname has also been adjusted within the RP if I SSH into it and check the /etc/hosts file:
Is there anything else that I can check to see what would be causing this issue? Would it potentially be an issue with my router? I don't have my own personal router, it's the one that was given to me by my ISP (which is Comcast if that helps at all). Any help on this is much appreciated :)
-
Could you try to use
retropie.local
? -
@fitchneraubarca I've seen similar things in the past with some of my builds as well. Not that I have a solution as I never really dug into it but just so you know you aren't going crazy
-
@herb_fargus happy to hear that I'm not the only one :)
@Sano that seems to work! Here's what things look like within my terminal:
So it seems like there's a security concern since, right before I was able to connect using
retropie.local
, the terminal asked the following:The authenticity of host 'retropie.local (10.0.0.xxx)' can't be established.
ECDSA key fingerprint is SHA256:+7blah blah blah.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'retropie.local' (ECDSA) to the list of known hosts.
Not sure at all why that's happening. Also, why is
retropie.local
necessary? I've tried usingretropie
after I remoted in usingretropie.local
, but I still wasn't able to. -
@fitchneraubarca You get that message the first time you ssh over to the pi. I've seen that the first time I've logged into any new build.
-
@hurricanefan Darn... Got excited that I saw something new. Well, sounds like I just gotta stick with SSH'ing with
retropie.local
for now. -
@fitchneraubarca
On windows, the .local suffix of mDNS is included in the search domains.
For security reasons, it's no possible on Linux, you have to use the FQDN (and not short names) for mDNS entries.
Even by adding .local to DNS search domains it doesn't work because mDNS resolution doesn't use the DNS resolv.conf file...I did some searching a while ago but didn't find an easy solution aside from changing mdns suffix from .local to something else...
A quick and dirty solution for using the short name is to add an entry in /etc/hosts on your workstation, but this won't follow eventual IP change of your raspberry.
You can also create an alias on your workstation by addingalias retropie="ssh pi@retropie.local"
in your ~/.bashrc file. That's what I did. -
@sano so you just enter "retropie" nothing else into the comandline?
-
@drakaen391
Yup !
With key-based ssh authentication, nothing else to type :) -
Thanks @Sano ! My networking understanding isn't quite up to your level. However, I overall understand what you're saying and it all makes sense. At least there's a logical explanation to all of this :) Thanks for all of your (and everyone else's) help on this.
-
@sano said in Unable to Use Hostname to SSH:
With key-based ssh authentication, nothing else to type :)
Only if the key itself has no passphrase, which makes it usable by anyone who gets their hands on it. It also makes it easy to jump systems if the one holding the key is compromised.
I mention this mostly for @FitchnerAuBarca and other ssh newbies. I don't think this is a big security concern in most Retropie use cases, but I think it's worth noting for the sake of completeness, especially for people who are new to the whole concept of key-based authentication. :)
-
@clyde
Yes, you may be careful if your key has no passphrase (that's why it's protected by mandatory and specific access rights on the system).
You may also use a passphrase and an ssh agent to only have to type the passphrase once per user session ;) -
@sano said in Unable to Use Hostname to SSH:
You may also use a passphrase and an ssh agent to only have to type the passphrase once per user session ;)
Correct, I had that in mind but didn't articulate it. Thanks for the addition. :)
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.