Open TCP Port 3389 on Ubuntu Firewall for Remote Desktop Connection

Open the terminal (Ctrl+Alt+T) and run this command (root privileges is required):

sudo iptables -A INPUT -p tcp -d 0/0 -s 0/0 –dport 3389 -j ACCEPT

Replace 3389 with the port you want to open.

How do you close the ports?

Simply replace ACCEPT with DROP as follows:

sudo iptables -A INPUT -p tcp -d 0/0 -s 0/0 –dport 3389 -j DROP

Print Friendly, PDF & Email