To open port 23 (which is used for Telnet) on an Ubuntu Server 16.04, you need to ensure that the Telnet server software is installed, and then configure your firewall to allow traffic on port 23.
Step 1: Install the Telnet Server
First, you need to install the Telnet server package, which is called telnetd. You can do this using the apt package manager. Run the following command:
sudo apt update
sudo apt install telnetd
Step 2: Start the Telnet Service
After the installation is complete, you may need to start the Telnet service. The specific command may vary depending on the version, but typically you can use:
sudo systemctl start inetd
or, if it's running under xinetd, you may need to ensure that xinetd is running:
sudo systemctl start xinetd
Step 3: Configure the Firewall
If you are using ufw (Uncomplicated Firewall), you will need to allow connections on port 23 (Telnet). You can do this with the following command:
sudo ufw allow 23
To check the status of your firewall and ensure rules are applied, you can use:
sudo ufw status
Step 4: Enable the Telnet Service on Boot
If you want the Telnet service to start automatically on boot, use the following command:
sudo systemctl enable inetd
or for xinetd:
sudo systemctl enable xinetd
Important Security Note
Using Telnet is generally not recommended for production systems because it transmits data, including passwords, in plain text. It is advisable to use more secure alternatives such as SSH (Secure Shell) for remote access:
sudo apt install openssh-server
After installation, you can allow SSH through the firewall with:
sudo ufw allow ssh
Conclusion
After completing these steps, you should be able to connect to your Ubuntu Server 16.04 using Telnet on port 23. Be aware of the security implications and consider switching to SSH for a more secure connection.