Never Ending Security

It starts all here

Howto bind ssh to selected IP address

ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine. It is intended to replace rlogin and rsh, and provide secure encrypted communications between two untrusted hosts over an insecure network. X11 connections and arbitrary TCP ports can also be forwarded over the secure channel.

We all know, by default installation of openssh daemon service (sshd), it binds itself to all existing IP address from given host.

Alternatively, if you wish to bind sshd service to selected IP address, this is possible by simply editing /etc/ssh/sshd_config file.

First, always make a backup copy of conf files you wish to edit.

# cp /etc/ssh/sshd_config /etc/ssh/sshd_config.backup

Launch your fave text editor and edit /etc/ssh/sshd_config

#vi /etc/ssh/sshd_config

Go to specific lines that shows

ListenAddress *

If you wish to bind ssh to existing 2 IP address, let’s say and , this could be done by changing the above sshd_config lines to


and Restart sshd daemon using the following command

# service sshd restart

One applicable instance that his can be useful is that when you have a group of ssh users and there are times you need to disconnect all those currently logged in ssh users except your own remote ssh connections. This can be simply done by shutting down the other interface from where those ssh users are currently connected. And ofcourse, you need to be currently connected with the other interface before shutting down the other interface or IP address.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s