Monday, September 2, 2024

unable to SSH into VPS after upgrade of Ubuntu from 20 to 22 LTS

Prior to upgrading from Ubuntu 20 to 22 LTS I was able to SSH from my local laptop to a remote VPS using the command

ssh -v username@IPaddress

After the upgrade I got

ssh -v username@IPaddress
OpenSSH_9.7p1, LibreSSL 3.3.6
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to IPaddress [IPaddress] port 22.
debug1: connect to address IPaddress port 22: Operation timed out
ssh: connect to host IPaddress port 22: Operation timed out

Via the recovery console on the remote VPS I ran

sudo systemctl status ssh
and got
Active: active (running)

 

Via the recovery console on the remote VPS I ran

sudo service ssh stop
sudo service ssh start
sudo service ssh restart

https://askubuntu.com/questions/462968/take-changes-in-file-sshd-config-file-without-server-reboot 

On the remote VPS I reviewed the contents of /etc/ssh/sshd_config

I verified that SSH is exposed on port 22 using

sudo lsof -Pi | grep ssh

On the VPS I monitored

sudo tail -f /var/log/auth.log
and concurrent attempted to log in from my local laptop
ssh -v username@IPaddress
Since no entries were showing up in auth.log, maybe there's a firewall configured?

Yes, firewall exists; see https://physicsderivationgraph.blogspot.com/2020/09/ufw-allow-status-numbered-delete.html

$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), deny (routed)
New profiles: skip
I temporarily disabled the firewall on the VPS using
sudo ufw disable
as per https://ubuntu.com/server/docs/firewalls and then monitored
sudo tail -f /var/log/auth.log
while trying to SSH from my laptop, but that didn't make a difference. Therefore I can rule out the firewall as blocking SSH. I then ran
sudo ufw enable

Next I enabled password-based auth in /etc/ssh/sshd_config with

PasswordAuthentication yes
and then
sudo service ssh restart
Then tried to SSH from my laptop but still no difference -- just a time-out and no new lines in /var/log/auth.log.
ping google.com
ping: google.com: Temporary failure in name resolution
I inspected the content of
/etc/resolv.conf
which has the line
nameserver 127.0.0.53
options edns0 trust-ad
search .
resolvectl status
journalctl -u systemd-resolved -f

Actually, my DNS might not be the issue:

ping 8.8.8.8
ping: connect: network is unreachable

The DNS problem is described on https://askubuntu.com/questions/1452215/dns-resolution-broken-after-upgrading-ubuntu-20-04-to-22-04 but

sudo dpkg-reconfigure resolveconf
but that doesn't work:
dpkg-query: package 'resolveconf' is not installed and no information is available.

The thread https://askubuntu.com/questions/1436144/no-network-after-upgrading-from-ubuntu-20-04-to-ubuntu-22-04 also didn't provide any insights for my situation.

No comments:

Post a Comment