How to open a port

5 posts / 0 new
Last post
#1 Fri, 06/03/2011 - 11:06

How to open a port

I want to setup remote desktop and I need to open port 5901. I was not successful to do so in ssh. How I can do this in Webmin to check if it is really open?

Fri, 06/03/2011 - 11:20

Is your server behind a NAT router?

If so, you would need to forward port 5901 from your router to your server.

You would only need to open a port on your server if you had setup a firewall on it, which isn't the default setting.

If you are running a firewall on your server -- do you know what kind of firewall it is, or how it was setup?


Fri, 06/03/2011 - 17:57

Also, what did you do in SSH to "open the port"?

To answer this kind of questions, we need more information about your server and network. In addition to what Eric asked: What kind of server do you have (rented, co-located, at home, virtual or physical)? Is it behind a router or hoster-side firewall? What Linux distro? Are you running a software firewall? If so, which one? iptables? Are you additionally using a hardware firewall or Linux FW distro like IPCop?

Sun, 10/06/2019 - 00:08
Francewhoa's picture
How to open a port

Two options to do this

First option

Using Webmin, under “Networking ---> Linux Firewall”. But this might be lots of clicks. Find the next steps into this documentation at

Second option

This second option is sometime much easier and faster. In summary you use only two command lines to open a port, then you optionally use Webmin for customizing the newly open port. If you are using Debian and IPTables (Linux Firewall) for your firewall, and if you are familiar with Terminal/Console, the steps:

  1. SSH into your server either as Sudo or as Root

  2. Run this first command line to open a port iptables -A INPUT -p tcp -m tcp --dport <PORT TO OPEN> -j ACCEPT

  3. In this command line above, simply replace <PORT TO OPEN> with any one port you need to open. For example iptables -A INPUT -p tcp -m tcp --dport 10000 -j ACCEPT

  4. Run this second command to save the newly open port to the master IPTables configuration file. iptables-save > /etc/iptables.up.rules

  5. You need to apply the IPTable configuration. To do so using Webmin, navigate to “Networking ---> Linux Firewall”. Scroll all the way down this page. Click on “Apply Configuration” button.

  6. Optionally, you can use Webmin to either customize, block/close, or delete the new firewall rule you created above. To do so, using Webmin navigate to “Networking ---> Linux Firewall”. Or go directly to /firewall/?xnavigation=1

  7. Done you have successfully open a port


- - -
Senior Product Manager, and Co-Founder at Inc.
Love back your Virtualmin & Webmin community

Sun, 10/06/2019 - 05:45

IF CSF firewall then there to. ;)

And all firewall related parts at client side ofcourse. ;)

Topic locked