This is an “oldie but a goodie” for some of you, but it always bears a reminder.

If you try to upgrade your ssh server remotely it will likely hang when you go to restart the service after upgrading.

A client recently needed chroot sftp capabilities on their server and their OpenSSH server was out of date. They were on version 4.3 and the chroot sftp capabilities were added in 4.4. I upgraded e machine to version 5.8 today. It has been a while since I’ve needed to do this remotely and I almost restarted sshd in my ssh session when I remembered I would likely have my session disconnect during the restart and the start process would fail.

Definitely not what you want for your customer!

In comes in the wonderful screen utility. The screen program lets you start a terminal session within your session that won’t get killed when sshd restarts. I just installed screen, typed screen and entered my new session-within-a-session. Now I restarted openssh and it killed my remote session, the screen session survived and completed the openssh restart.

I was able to connect right back in to the new version of the sshd server with no issues.