Score:1

Unable to SSH into Ubuntu Server 20.04

no flag

Before I begin, I am very aware of this thread. This question is not a duplicate of that one because the troubleshooting from that thread has not fixed my issue.

I have set up an ubuntu 20.04 server on a raspberry pi 4. I have installed openssh-server on that server and enabled it. I have also assigned it a static IP in the netplan

network:
  version: 2
  ethernets:
    eno1:
      dhcp4: false
      dhcp6: false
      addresses:
        - 127.0.0.2/24
      routes:
        - to: default
          via: 127.0.0.1
      nameservers:
        addresses: [127.0.0.1]

This netplan has assigned a static IP address to my ethernet port (eno1) - ip addr shows

... lo and wlan0 etc 
eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
   link/ether <mac address omitted> brd ff:ff:ff:ff:ff:ff
   inet 127.0.0.2/24 brd 127.0.0.255 scope host eno1
      valid_lft forever preferred_lft forever
   inet6 <ipv6 omitted> scope link
      valid_lft forever preferred_lft forever

The output of sudo systemctl status ssh outputs that ssh server is enabled.

Now for my client machine (what I'm trying to connect to the server with). I am running Ubuntu 22.04 LTS. I have also installed openssh-server and it is running. I have also added the same netplan (apart from changing) the addresses clause to hold [127.0.0.3/24] - since the host and client cannot have the same IP.

I have also modified the firewall for both machines to enable ssh (open port 22) and tested it with nmap.

I cannot ssh into my server:

ssh ubuntu@127.0.0.2
meropis@OMEN:~$ ssh ubuntu@127.0.0.2
ubuntu@127.0.0.2's password: 
Permission denied, please try again.
ubuntu@127.0.0.2's password: 
Permission denied, please try again.
ubuntu@127.0.0.2's password: 
ubuntu@127.0.0.2: Permission denied (publickey,password).
meropis@OMEN:~$ 

This connects and does the usual fingerprint not recognized jargon, then asks me to log in to ubuntu@127.0.0.2 - to all the world this looks like its working. Then I enter my password (which I know is completely correct and have reset multiple times) and it says the password is incorrect. Can anyone see anything I'm doing wrong??


It should be mentioned that I do not have any internet access on the ubuntu server. This is a separate issue I am attempting to solve. Please do not include solutions that involve me installing a package as I am unable to do so.

Joe Moore avatar
no flag
I see how this could be a problem with the 127.x.x.x range being used. I wasn't aware that it was used for local loopbacks. I have a feeling this may be the cause of my issues. I'm going to assign my `eno1` and `wlan0` both different ip bands and give it another test. Wish me luck!
Joe Moore avatar
no flag
I have an issue there since I am a university student and don't have access to my router. I'm also not using WiFi - I'm using Ethernet. If its possible to handle IP addressing at the router acting as my client how would I go about doing that?
Joe Moore avatar
no flag
Update - I have just scanned the IP address of the server from my client and it came back and identified it correctly! Now, I am not able to ssh into the server - it says connection refused. I'm definitely getting closer :)
Joe Moore avatar
no flag
Hey! I actually managed to ssh from the server into my client now! I have to sort out the backwards compatibility error then I think my problem is solved. Thank you for allowing me to bounce ideas of you it's been very very helpful.
Joe Moore avatar
no flag
Full solution written up. Thanks again!
Joe Moore avatar
no flag
Added as answer. I don't quite know why I've been downvoted. As much as it doesn't really matter to me I still think that downvotes shouldn't be allowed without a comment explaining why that result has been left. To me this question and answer was a model way of how the Stack network should be used (apart from me adding an answer to my own solution).
Score:0
no flag

As mentioned by nmath above, 127.x.x.x are used for loopback addressing into the same client. Therefore attaching it as an address for ssh will not work. Therefore you must change your netplan addresses to something that is not a loopback (almost everything). In my case I chose 169.254.0.2 for my server and 169.254.0.3 for my client. Choose as you wish. After this refresh your netplans (sudo netplan generate, sudo netplan apply). Check your ssh server is working on both machines (sudo systemctl status ssh - should return ~"running"). Then, from your client try a ping command to your server. If it pings correctly try running ssh (if you're unsure about the ping latency mine was approx 1ms - look for this value!). Then voila! Your ssh should be working. If not, ensure you follow my exact steps and try again.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.