4

I have an Ubuntu 18.04 server. I installed openssh-server and openssh-client. According to apt, the installed version of both packages is 7.6p1-4ubuntu0.1, but the running version of the ssh-server (sshd) is OpenSSH_6.7p2 Ubuntu-4p1. The version of the client (ssh) is correct.

I already restarted the server several times, but the running version is still the same.

Recently I reinstalled OpenSSH, because my clients couldn't connect to the server with version 6.7. See: SSH connection closed right after login

It worked for a while, but then it suddenly switched back to version 6.7. (the installed package is still 7.6)

Could anybody please help me with this? I don't understand how the running version can differ from the package version.


Edit:

This is the output of the command dpkg -l | grep openssh as requested in the comments:

ii  openssh-client                        1:7.6p1-4ubuntu0.2                         amd64        secure shell (SSH) client, for secure access to remote machines
ii  openssh-server                        1:7.6p1-4ubuntu0.2                         amd64        secure shell (SSH) server, for secure access from remote machines
ii  openssh-sftp-server                   1:7.6p1-4ubuntu0.2                         amd64        secure shell (SSH) sftp server module, for SFTP access from remote machines

It might also be worth noting that I get the following error in the syslog when trying to log in:

sshd[15010]: segfault at ad6cd950 ip 00007f50883835a1 sp 00007ffcfb4f35f8 error 4 in libc-2.27.so[7f50881f5000+1e7000]


Edit 2:

After removing OpenSSH and reinstalling it again as recommended in this answer, it worked for an hour. This did not happen after a reboot or update. The actual ssh.service seems not to be running anymore. By running ps -o unit -p <process id>, I found out that the process has been started by env.service. I guess that is not correct, because right after the fresh installation, sshd has been started by ssh.service. But how can I change that behavior? I don't know, what env.service does.


Edit 3:

Something keeps replacing /usr/sbin/sshd with the old version within less than an hour after reinstalling openssh-server. I can see that the MD5 hash has been changed.

12
  • How did you determine that version OpenSSH_6.7p2 Ubuntu-4p1 is running? What is the output of dpkg -l | grep openssh? Add both to your question by editing your question.
    – Thomas
    Dec 30 '18 at 12:07
  • Package names (and numbers) are not the same as version numbers.
    – guiverc
    Dec 30 '18 at 12:08
  • @Thomas I executed sshd -V (and /usr/sbin/sshd -V which resulted in the same output). Additionally, my client on OS X tells me that the server is using OpenSSH_6.7p2. The output of your command is a table with openssh-client, -server and -sftp-server. The version is 1:7.6p1-4ubuntu0.1 for all of them.
    – FelixSFD
    Dec 30 '18 at 12:11
  • @guiverc: not necessarily, but if you have such a big difference in versions, then something is wrong.
    – Thomas
    Dec 30 '18 at 12:22
  • @FelixSFD: so sshd -V does result in OpenSSH_6.7p2? Did you somehow overwrite the binaries in /usr/sbin/sshd by copying things or similar?
    – Thomas
    Dec 30 '18 at 12:26
0

1) Backup you config file

2) Remove via apt openssh-server

3) Reboot

4) Run apt update

5) Run apt-get autoremove

6) Reinstall openssh-server. (for Ubuntu 18.04 the versiòn is 1:7.6)

1
  • I already reinstalled openssh-server several times, but after some days, it keeps switching back to the old version
    – FelixSFD
    Jan 26 '19 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.