LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices



Reply
 
Search this Thread
Old 01-20-2009, 06:50 AM   #1
bkcreddy17
Member
 
Registered: Feb 2008
Location: India-Hyderabad
Distribution: RHEL and Fedora
Posts: 171

Rep: Reputation: 15
Wink iptables rule


Hi,
Plaese any body clarify my doubt in this rule. I want to restrict whose uid is 501 from outgoing to port number 22.This blocks all.
Code:
$ sudo /sbin/iptables -t filter -A OUTPUT -m owner --uid-owner 501 -j DROP
I tried like this but, no result.
Code:
$ sudo /sbin/iptables -t filter -A OUTPUT -p tcp -m owner --uid-owner 501 --sport 22 -j DROP
and
Code:
$ sudo /sbin/iptables -t filter -A OUTPUT -p tcp -o eth0 -m owner --uid-owner 501 -s 0/0 --sport 22 -j DROP
What will be the rule?

Last edited by bkcreddy17; 01-20-2009 at 06:52 AM.
 
Old 01-20-2009, 07:29 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
You'd want a dport, not an sport. the source port will just be a random ephemeral number.
 
Old 01-20-2009, 07:38 AM   #3
bkcreddy17
Member
 
Registered: Feb 2008
Location: India-Hyderabad
Distribution: RHEL and Fedora
Posts: 171

Original Poster
Rep: Reputation: 15
Thank you. Got it by
$ sudo /sbin/iptables -t filter -A OUTPUT -p tcp -o eth0 -m owner --uid-owner 501 -s 0/0 --dport 22 -j DROP
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
iptables: rule with RETURN target just after a rule with ACCEPT target Nerox Linux - Networking 6 09-04-2011 04:33 PM
iptables rule DJ29Joesph Linux - Security 4 11-04-2008 01:55 AM
iptables rule help the_gripmaster Linux - Security 3 05-15-2007 08:19 AM
help with iptables rule!! vishamr2000 Linux - Security 6 11-09-2005 06:34 AM
IPTables Rule... Grim Reaper Linux - Software 8 04-28-2003 01:20 PM


All times are GMT -5. The time now is 05:25 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration