Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Please help me create a batch file that I want have it configured every time any user logs in to my personal computer (there are couple of non-admin non-root users) Another concern is that this should run invisible, i.e. no prompts, etc.

I want to have this command run invisibly at every user login to my PC : sudo iptables -A OUTPUT -p tcp -m owner --uid-owner anotheruser -j DROP

Basically, this command stops internet access for this user 'anotheruser'. And I want to have this command run every time this (or any other user) logs in to my PC.

share|improve this question

1 Answer 1

If you didn't need it to run as root, you'd be best to write it as a script and put it in /etc/profile.d/. profile.d scripts are executed on login. However, since you need it to run as root invisibly, you'd probably either need to:

  • Make a daemon to do it
  • Have root run a while loop for user logins

There's probably some other ways too.

share|improve this answer
    
thanks for your reply, but you are talking to a noob here (sorry). Can you give me any directions on these, any sites probably which can help on these two options. –  whizkid Feb 1 '11 at 10:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.