Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a server with SSH and OpenVPN services. I'd like to make sshd listen only on the openvpn ip. The problem is, until openVPN is up and tun0 is set, sshd can't be bind to the openvpn's ip.

I'm running debian stable on my box.

Thanks for any help.

share|improve this question

You could remove the start of sshd from various RCX (update-rc.d).
Then you could add a line into the openvpn startup script that starts sshd when openvn is up.
You could make a bit better checking if the ip of the openvpn is up and runnning and then startup the sshd.

share|improve this answer
Okay thanks for this answer, but I was looking for a cleaner solution, or at least something better integrated to debian. – plop90 Jun 21 '10 at 12:39

Take a look at /etc/network/if-up.d/openssh-server and read this article.

share|improve this answer
Thanks I will take a look a that. – plop90 Jun 21 '10 at 13:41

Write a "post-up" OpenVPN script that restarts the sshd.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.