LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 12-01-2006, 06:41 AM   #1
darkone66669
Member
 
Registered: Mar 2004
Distribution: Fedora 10
Posts: 85

Rep: Reputation: 15
How to block a certain user from accessing the internet


I need to know if there is a way to block a certain user from accessing the internet. I am using Mandriva 2006. It is installed on my home computer and everybody in the house has their own login including my 7 yr old son. I'd like to know if I can keep him from being able to access the internet without having to look over his shoulder every second hes on it. Since we are all using the same machine I can't use any IP blocking methods. any help would be greatly appreciated since my son loves linux and I would hate to kill his account.
 
Old 12-01-2006, 06:49 AM   #2
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 33
run a script that clears the default route when your son logs on, and restores it when your son logs off
 
Old 12-01-2006, 07:25 AM   #3
sarajevo
Member
 
Registered: Apr 2005
Distribution: Debian, OpenBSD,Fedora,RedHat
Posts: 228
Blog Entries: 1

Rep: Reputation: 31
Or make some iptables rule that will allow only some users to start internet connection...or make some other rule that will disable network interface when some user log on ... ( your son for example )



Regards
 
Old 12-01-2006, 07:28 AM   #4
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 33
as far as i know there is not way of writing iptables rules to block a certain 'user'!! iptables works on a different layer!
 
Old 12-01-2006, 07:42 AM   #5
sarajevo
Member
 
Registered: Apr 2005
Distribution: Debian, OpenBSD,Fedora,RedHat
Posts: 228
Blog Entries: 1

Rep: Reputation: 31
Quote:
Originally Posted by Nathanael
as far as i know there is not way of writing iptables rules to block a certain 'user'!! iptables works on a different layer!

not really
to darkone66669 ,,, first do

id your_son_login_id... you will get some number, for root il look like
id root

uid=0(root) gid=0(root) groups=0(root)
so means instead of root enter login name of your son, ....
check first have you iptables installed on your system, I suppose you have, check it using

iptables -L -n
you should receive output like
TheRocket:/# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
TheRocket:/#
...

then open vi editor and write this ...

iptables -A OUTPUT -m owner --uid-owner 1000 -p all -j DROP

1000 is my id, you should put there id you receive as output of id command... save that file,
chmod 755 file_of_rule.sh

and execute it using ./file_of_rule.sh every time before your son want to use internet
or easier put it inside /etc/rc.d....... I do not exactly to where are init scripts on Mandriva and make it execute every time you switch on computer,

I home this helps.

Regards
 
Old 12-01-2006, 12:37 PM   #6
live_dont_exist
Member
 
Registered: Aug 2004
Location: India
Distribution: Redhat 9.0,FC3,FC5,FC10
Posts: 257

Rep: Reputation: 30
I'm no iptables whiz but there could be a very simple solution to the above problem..

Put a commnd in your son's .bash_profile which says
"ifconfig eth0 down". So each time he logs in the network inerface will get disabled.

Putting stuff in /etc/rc.d will make it global..not sure thats what you want.

Cheers
Arvind
 
  


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
by using iptables block mac address to restric user to access internet Farrukh Fida Linux - Networking 3 10-09-2006 07:59 AM
How do i block certain LAN IP from accessing Internet? asoka_ajay Linux - Networking 5 05-04-2006 03:44 AM
Block accessing inernet directly how to shipon_97 Linux - Newbie 1 03-27-2006 02:16 PM
Prevent user from accessing the Internet koy-b Linux - Security 2 07-17-2004 12:17 PM
SQUID:How can I block my LAN clients accessing Internet mwj Linux - Networking 1 10-27-2003 04:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 10:29 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
Open Source Consulting | Domain Registration