I seem to get problems with SSH every now and then, and they are always a little obscure. I guess it’s just because I use it so much. Here’s my latest one.
spanky@spanky:~$ ssh admin@jenny
ssh_exchange_identification: Connection closed by remote host
spanky@spanky:~$
Ok so we have a Windows style error message – it tells us the connection was closed, but no indication of why. I also tried SSH’ing from multiple different boxes which normally work, and all yielded the same error. Jenny is a FreeBSD 7.0 box I use for database testing. I logged in physically to check this out. and found that my messages log file was spammed with errors of the /dev/null file missing. Interestingly enough, I couldn’t run any programs (w, ls etc.) because they all complained about the null device. I never realised how much depends on it…
The cause of this was that when I was compiling the Percona database source, it removed my /dev/null file. Incidentally the Percona compilation failed, although it is a problem with the InnoDB source / Makefile that is known. Anyway, a quick reboot of the server fixed it as it causes the device filesystem to be repopulated. If you every get this happening on a production server, I suppose you could just mknod the null device. I don’t know what the correct major / minor numbers on FBSD7.0 are though. There wasn’t really any need to learn given that I knew a reboot would fix it anyway – it did.