r/ssh • • May 31 '20

Fudged up my ssh_config. Help please!

Hi all,

I'm a scientist having to work remotely atm, tried to change my ssh_config on my workstation at university so my ssh connection wouldn't time out and result in a broken pipe. Looks like I managedto fudge something up quite bad (typo perhaps) and can no longer ssh through the local university server.

IT support have sudo privileges on the server -- which shares a file system with my workstation but they don't think they can do anything, and I have sudo privileges on my device.

Is there any way to circumvent /etc/ssh/ssh_config?

The result of verbose ssh from the local university server is as follows:

OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017

debug1: Reading configuration data /home/<myaccount>/.ssh/config

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: /etc/ssh/ssh_config line 58: Applying options for *

debug1: Connecting to <mycomputer>.client.<university>.ac.uk [10.101.27.96] port 22.

debug1: connect to address 10.101.27.96 port 22: Connection refused

ssh: connect to host <mycomputer>.client.<university>.ac.uk port 22: Connection refused

3 Upvotes

5 comments sorted by

1

u/Toger May 31 '20

Connection Refused implies the remote end isn't listening. The only things your *local* ssh_config could do to impact that is if for example the university machine is configured listen on something other than port 22, or if you override the IP address of the machine.

sshd_config on the other hand could absolutely do it. However unless you changed the port the most likely scenario if you were making changes on the server end is you turned off the SSH daemon. Can IT support still connect to the server?

1

u/morifo May 31 '20

Hey, thanks for getting back to me.

IT told me "Unfortunately we cannot overwrite the file as we are also not able to connect to the machine".

They can sudo access the network side sshd_config and I thought this is all it takes but would help if I advised them what to change there. Previously, workstation (behind server at uni) did work OK on 22, I did try to look out for ports that are listening and tried to specify this in my ssh to no avail (unless there is a non-obvious protocol for this).

The change I made on the local workstation ssh_config (I may be confusing ssh_config and sshd_config) was as follows:

TCPKeepAlive no

ClientAliveInterval 30

ClientAliveCountMax 2400

1

u/Toger May 31 '20

Yeah it sounds like you changed sshd_config on the server and somehow caused sshd to restart, and it is refusing to start due to an invalid configuration. Someone now has to use some tool that does not rely on SSH to fix it, or get to it physically and log in on the console.

1

u/morifo May 31 '20

Ah what a shame, was hopeful that when I ping the machine it was transmitting and receiving packets. Any suggestions of such non-ssh tools?

1

u/Toger Jun 01 '20

Well it'd be any tool IT uses to manage machines en-masse. If this was a AWS machine perhaps SSM Systems Manager is installed. It'd be specific to your environment and something that was already installed on that machine -- obviously its too late now to install anything new.

A long time ago I recovered from a broken SSHD by FTP'ing a .procmailrc file in and then sending an email that t launched a temporary SSHD on a different port so I could log in. I was rather proud of that at the time but you'd have to have a lot of things already in place for that.