Reset network settings

My laptop is running KDE Neon with all the latest updates. I would like to use this to ssh to my work. I use a config file for this purpose on my desktop. I copied the config file over along with the rsa key files from my desktop to the laptop. AFAICT the laptop and desktop use the same settings but I am unable to connect from the laptop. It gives me the following error:

kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

My config file has the following:

Host blah
  HostName blah.com
  User kayvee  
  PasswordAuthentication yes
  HostkeyAlgorithms +ssh-rsa
  PubkeyAcceptedKeyTypes +ssh-rsa
  ControlMaster auto
  ControlPath /tmp/ssh-blah
  LocalForward 33333  workcomp:22

Match user kayvee !originalhost blah
  ProxyCommand ssh -q blah -W %h:%p

Host workcomp
  HostName localhost
  Port 33333
  User kayvee
  IdentityFile ~/.ssh/blah_identity
  AddKeysToAgent yes
  PreferredAuthentications publickey,password
  PasswordAuthentication yes
  KbdInteractiveAuthentication yes

Since the exact same config works fine from my desktop, I am inclined to believe that I may have changed some of the network settings on my laptop that are causing this to happen. Is there a way to reset all network settings to defaults? Short of just reinstalling Neon, what are my options?

Check the permissions of files and directories.

Does blah work?

I checked the permissions of my .ssh/config and all of the rsa key files. They are at least readable by everyone and writable by me.

I typically connect as follows:

ssh -Nf blah
ssh workcomp

The first command succeeds without any issues. It asks me for a verification code from my authenticator app followed by password and then connects to the server.

It is only when I execute the next command to ssh to workcomp that I see the kex_exchange_identification error.

Well, that doesn’t sound like a great start.

https://www.google.co.uk/search?q=linux+.ssh+permissions

Sorry, I was incorrect. My permissions match the ones from your link.
The private key file has -rw------- and the public .pub file has -rw-r--r--.

It’s the ProxyCommand that seems to be failing. Here’s what I see:

$ ssh -Nf blah
(kayvee@blah.com) Verification code: 
(kayvee@blah.com) Password: 

$ ssh -vvv workcomp 
OpenSSH_8.9p1 Ubuntu-3ubuntu0.10, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /home/kayvee/.ssh/config
debug2: checking match for 'user kayvee !originalhost blah' host workcomp originally workcomp
debug3: /home/kayvee/.ssh/config line 28: matched 'user "kayvee"' 
debug3: /home/kayvee/.ssh/config line 28: matched '!originalhost "workcomp"' 
debug2: match found
debug1: /home/kayvee/.ssh/config line 46: Applying options for workcomp
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/kayvee/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/kayvee/.ssh/known_hosts2'
debug1: Executing proxy command: exec ssh -q blah -W localhost:33333
debug1: identity file /home/kayvee/.ssh/blah_identity type 0
debug1: identity file /home/kayvee/.ssh/blah_identity-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.10
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

I finally gave up and reinstalled KDE Neon on my laptop.
Before doing so, I booted into the live image and ssh’d to my work machine. without any issues. However, after reinstalling I get the exact same error when I try to log in. Even now, when I use the live image, I am able to ssh to my workcomp but not from an installed copy.
This is strange.

I figured out what the issue is! :tada:
I have the same username for the remote machine I am logging to and local machine I am logging from. If I create a new user with a different username, I am able to use the exact same config file and login to the remote machine.
For now I have a workaround. I am just going to use a different username. Eventually, I need to figure out how to make this work with the same username on both remote and local machines.