LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-10-2005, 03:23 AM   #1
iclinux
Member
 
Registered: Dec 2004
Posts: 69

Rep: Reputation: 15
How to disable a port, such as 21?


Hi there,

I want to write a program that can disable specified ports, such as 21, 80. But I don't know how to do it.

Will you please make a suggestion for me? Thanks a lot.
 
Old 01-10-2005, 04:48 AM   #2
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
what do u mean by disabling a specified port?
if u mean "blocking port", u can do that with iptables:

#iptables -I INPUT -p tcp --dport 21 -j REJECT

good luck.
 
Old 01-10-2005, 04:48 AM   #3
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
These are 2 firewall rules for iptables that block your specified TCP ports 21 and 80 for your
eth0 interface :

iptables -A INPUT -i eth0 -p tcp --dport 21 -j DROP
iptables -A INPUT -i eth0 -p udp --dport 80 -j DROP

But if you don't run a ftp server and a web server, these ports should not be open in your
machine
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable port 3128 cyucuis Linux - Security 6 01-08-2004 02:51 PM
How do I disable a firewire port? rentz Linux - Hardware 0 12-22-2003 03:33 PM
How to disable application(s) using port 22 Johnnyboy Linux - Newbie 7 09-21-2003 10:18 AM
Disable Port 80 dvong3 Linux - Security 2 09-19-2003 08:32 AM
Disable port 6000 hegrunt Linux - Software 4 09-08-2003 12:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration