Search This Blog

Showing posts with label Telnet. Show all posts
Showing posts with label Telnet. Show all posts

Wednesday, September 8, 2010

Disable Telnet Service in Linux

Telnet is a service using which we can remotely communicate with server.However ssh is more secure alternative to it.Therefore we should disable this service by default.

Here is what you need to do if you are using redhat/centos 4,5.

This service is usually named as krb5-telnet.
You just need to edit file under /etc/xinetd.d/krb5-telnet.
Following is the content of file where telnet is disabled .
# cat /etc/xinetd.d/krb5-telnet
# default: off
# description: The kerberized telnet server accepts normal telnet sessions, \
# but can also use Kerberos 5 authentication.
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/kerberos/sbin/telnetd
log_on_failure += USERID
disable = yes
}
Just restart xinetd service.
#/etc/rc.d/init.d/xinetd restart

Telnet should be disabled now.

Enable telnet service

Note:
First, telnet is insecure, and allowing root login, is just plain stupid.
Use su or sudo, and even better, use ssh.

By default ,Telnet service is disabled in many distributions (Which is highly recommended).

in redhat/centos4,5 telnet service is can be enabled by modifying following file
/etc/xinetd.d/krb5-telnet.

You just need to change disable parameter to no as below.

# cat /etc/xinetd.d/krb5-telnet
# default: off
# description: The kerberized telnet server accepts normal telnet sessions, \
# but can also use Kerberos 5 authentication.
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/kerberos/sbin/telnetd
log_on_failure += USERID
disable = no
}
Just restart xinetd service.
#/etc/rc.d/init.d/xinetd restart
and now you are able to get the telnet session of the server.However it will still not allow you to login using root.


However, if you need to allow access to the terminal that telnet uses for root
Add the following lines to /etc/securetty
pts/0
pts/1
pts/2
pts/3
pts/4
pts/5
pts/6
pts/7
pts/8
pts/9
Now you can able to login with root using telnet.