Showing posts with label firewall setting on centOS. Show all posts
Showing posts with label firewall setting on centOS. Show all posts

Friday, May 31, 2013

Install ssh on Linux - CentOS/Fedora/RHEL/SL


ssh (secure shell)
         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.

  ssh connects and logs into the specified hostname (with optional user name).  The user must prove his/her identity to the remote machine using one of several methods depending on the protocol version used (see below).

sshd (secure shell daemon) - ssh server

Install ssh on CentOS/Fedora/RHEL/Scientific Linux

Run following command in terminal
# yum install openssh-server openssh-clients

Start and stop the ssh service
# service sshd start & # service sshd stop

Automatically start the service at boot
# chkconfig sshd on

Check status of ssh
# service sshd status

Firewall :
Open Port 22 in Firewall :
Add following line in the file /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

Restart iptables
# service iptables restart

Check port 22 is opened or not
Run following command
# netstat -lnp | grep :22

Output should be like this
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 9657/sshd tcp 0 0 :::22 :::* LISTEN 9657/sshd

Install ssh on Debian/Ubuntu
click here