Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would like to open a port, use it, close it then run nmap to make sure it is closed. In Windows it seems straight forward enough but I have no idea how to do it in Linux.
If you have no clue then probably everything is "open", although really open of course requires a service listening on the port. Thus "open" here refers to unfiltered.
In order to close a port stop the service listening on it.
In order to filter a port and thus make it appear closed use iptables.
If you have no clue then probably everything is "open", although really open of course requires a service listening on the port. Thus "open" here refers to unfiltered.
In order to close a port stop the service listening on it.
In order to filter a port and thus make it appear closed use iptables.
I have haven't got a service running yet, I was just asking how to open and close ports. Is it really that difficult as I have been reading up on iptables and it makes absolutely no sense to me whatsoever.
What I need to know is if I run the mysql daemon will that automatically open a port (3306 I think it uses) and will it shut it down when I stop the daemon running and if it doesn't can I shut it down myself?
As said, a port is closed if no service is listening on it.
That means that 3306 is closed as long MySQL is not started (okay, something else might use the port, it's unlikely though).
A service handles it's port itself, you don't need to specifically open and close ports.
What you may need to do is filtering and "unfiltering" ports, which is done through IPTables, which is a packet-filter (to express it slightly simplified).
If IPTables is set to filter 3306 then, even after MySQL has started listening on that port, and thus the port being technically open, it will appear closed due to IPTables rejecting connection to the port.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.