First if you have any pre-installed SSH server that has gone bad, remove it-
on Redhat Architechture
Type the following commands as the root user:
# chkconfig sshd off
# service sshd stop
# yum erase openssh-server
You need to edit and update firewall rules that allows inbound connections to SSHs tcp port # 22. Edit /etc/sysconfig/iptables and /etc/sysconfig/ip6tables. In each file find and delete the line that access connection to port # 22. A sample entry:
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
Save and close the file. Restart the Linux firewall:
# service iptables restart
# service ip6tables restart
On Debian Architechture
Type the following commands:
# apt-get –purge remove openssh-server
Again, you need to edit and update firewall rules or firewall shell scripts that allows inbound connections to SSHs tcp port # 22.
Now it's time to install the SSH package again, reference installation for Redhat Architechture only
To install the server and client type:
# yum -y install openssh-server openssh-clients
Start the service:
# chkconfig sshd on
# service sshd start
Make sure port 22 is opened:
# netstat -tulpn | grep :22
Firewall Settings
Edit /etc/sysconfig/iptables (IPv4 firewall),
# vi /etc/sysconfig/iptables
Add the line
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
Src:
http://www.cyberciti.biz/faq/howto-unix-linux-remove-delete-opensshd-server/