LinuxQuestions.org
Register a domain and help support LQ
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
 
LinkBack Search this Thread
Old 01-20-2009, 05: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 05:52 AM.
 
Old 01-20-2009, 06:29 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,344

Rep: Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945
You'd want a dport, not an sport. the source port will just be a random ephemeral number.
 
Old 01-20-2009, 06: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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 03:33 PM
iptables rule DJ29Joesph Linux - Security 4 11-04-2008 12:55 AM
iptables rule help the_gripmaster Linux - Security 3 05-15-2007 07:19 AM
help with iptables rule!! vishamr2000 Linux - Security 6 11-09-2005 05:34 AM
IPTables Rule... Grim Reaper Linux - Software 8 04-28-2003 12:20 PM


All times are GMT -5. The time now is 01:51 AM.

Main Menu
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