Problem:
Set up telnet so it can only be used by localhost
Solution:
- sudo apt-get install xinetd
- sudo apt-get install telnetd
- add the following to /etc/xinetd.conf:
service telnet
{
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/sbin/in.telnetd
only_from = 127.0.0.1
}
- sudo /etc/init.d/xinetd restart
- should work from there.
Discussion:
The apt-get install command is the command used to download packages for ubuntu and debian. There are many packages that can achieve the goal of getting telnet to work only for the localhost, but xinetd seems to be the best one. Unlike standard inetd, xinetd does not use hosts.allow or inetd.conf. Instead it uses xinetd.conf to do both the service settings and the firewall settings. If you wanted the telnet server to be accessible by anyone you can take the only_from line out of the service configuration. Other services can be added to this file as well such as ftp.
- In order to get ftp working you will first need to get the package by running sudo apt-get install ftpd.
- add the following to /etc/xinetd.conf
service ftp
{
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/sbin/in.ftp.d
}
- restat xinetd by running sudo /etc/init.d/xinetd restart.
Its basically the same idea but we aren’t restricting the access to only the localhost like we did for telnet, so the only_from line was removed.
Root Access
- Root has some undefined password by default. Run sudo passwd to assign UNIX password.
You must be logged in to post a comment.