Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Similar to how I can run time command, I'd like to run a command such as dont_allow_network_access command. Is this possible?

share|improve this question

You can achieve this with lxc. This package contains a tool named lxc-unshare which you can use as follows:

# lxc-unshare -s NETWORK -- su username -c 'ping 127.0.0.1'
share|improve this answer
    
unshare from util-linux does the same thing. – grawity Oct 14 '12 at 16:26

This will get you a list of your network devices:

ifconfig -a

If your device you want to diable is eth0

ifconfig eth0 down

and to turn it back on:

ifconfig eth0 up
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .