I have installed openssh-server in my Ubuntu PC using apt-get install openssh-server. The version is 5.9.

Now, I would like to compile and install openssh-server version 6.2 from source codes. I have successfully downloaded the source codes, and run the following commands:

./configure make make install

I found that the new version of openssh-server was installed into /usr/local/sbin/. The old version of openssh-server was in /usr/sbin/.

I found that the service script in /etc/init.d/ssh is still pointing to /usr/sbin/. And the old openssh-server (v5.9) is still running.

  1. How can I replace the old openssh-server with the new openssh-server that I have just compiled and installed?
  2. How can I create a init.d script to start and stop the new openssh-server that I've compiled from source?
  3. How to start the new openssh-server on boot?
  4. When I install openssh-server using apt-get install, the config files will be installed into /etc/ssh/. If I compile and install it from source, where is the config file?


  • Why don't you edit the init script (looks like there are 2 lines below each other that point to /usr/sbin/)? That would solve 1 and also solve question 2 and 3. – Rinzwind Aug 2 '13 at 14:14

I've just installed version 6.4p from source and the config files are placed in

> /usr/local/etc$ ll total 284
> -rw-r--r-- 1 root root 242153 Jan 10 21:20 moduli
> -rw-r--r-- 1 root root   1576 Jan 10 21:20 ssh_config
> -rw-r--r-- 1 root root   2583 Jan 13 09:46 sshd_config
> -rw------- 1 root root    672 Jan 13 09:28 ssh_host_dsa_key
> -rw-r--r-- 1 root root    610 Jan 13 09:28 ssh_host_dsa_key.pub
> -rw------- 1 root root    227 Jan 10 21:20 ssh_host_ecdsa_key
> -rw-r--r-- 1 root root    182 Jan 10 21:20 ssh_host_ecdsa_key.pub
> -rw------- 1 root root    985 Jan 13 09:28 ssh_host_key
> -rw-r--r-- 1 root root    650 Jan 13 09:28 ssh_host_key.pub
> -rw------- 1 root root   1679 Jan 13 09:28 ssh_host_rsa_key
> -rw-r--r-- 1 root root    402 Jan 13 09:28 ssh_host_rsa_key.pub

To get the old version removed, I've set up the new one to run on a different port, copied the init script of the old version and modified it to point to the new installed one. I can now have the two versions running so I can test the new install, I'm keeping the old one around for a day or so in case something goes pear shaped so I've still got access (my server is totally remote). Once I'm happy, I can just remove the old version using apt, clean up any config files I may still have lying around and then reboot. Good luck!

|improve this answer|||||

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.