Feb 13, 2011

Add SSH Service to Xinetd in RHEL


Add SSH Service to Xinetd in RHEL


Release:
RedHat Enterprise Linux

Problem:
Add the ssh service to xinted in RedHat Enterprise Linux Server.

Solution:

1)      First need to check the services file, for weather ssh is defined on port 22  or not.

                        # grep ssh /etc/services
                 
            ssh   22/tcp            # SSH Remote Login Protocol
            ssh   22/udp            # SSH Remote Login Protocol

Note: If not defined means add the above entries in the services file.

2)      Create a file ssh inside /etc/xinetd.d directory for add ssh service into xinetd service.

                        # cd /etc/xinetd.d
            # vi ssh
           
            service ssh
            {
                    socket_type            = stream
                    protocol               = tcp
                    wait                   = no
                    port                   = 22
                    user                   = root
                    server                 = /usr/sbin/sshd
                    server_args            = -i
                    disable                = no
            }
                       
Note: Here “Server” indicates, where your openssh installed location.

3)      Now restart the xinetd service

                        # service xinetd restart

4)      Now check with netstat command, weather port number is listening or not

                        # netstat -an | grep 22
           
            tcp        0      0 :::22        :::*      LISTEN

Note: Using this we can add any service (like ftp) to the internet service daemon (inetd).

No comments: