Ask Different is a question and answer site for power users of Apple hardware and software. 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

I'm sharing my internet in work and forgot to turn it off! Does anyone know how I can do it via the command line? I have SSH access but thats it. D'oh.

share|improve this question
possible duplicate of Start/stop internet sharing from a script? – user588 Mar 25 '11 at 2:21

You could use this to turn it off:

sudo ifconfig en1 down

And if you want to get it back up, just type up, instead of down

Just make sure that en1 is the right interface or you can easily kill off your ssh access :)

P.S. As Lri noted in the comments below, you can quickly disable the correct network interface with just 1 line:

sudo ifconfig `networksetup -listallhardwareports | grep -E '(Wi-Fi|AirPort)' -A 1 | grep -o "en."` down

This will detect the correct Airport/wireless device and will turn it off

share|improve this answer
Or en0 on MacBook Airs. You can find out the device name with networksetup -listallhardwareports | grep -E '(Wi-Fi|AirPort)' -A 1 | grep -o "en.". – user495470 May 16 '12 at 14:35


networksetup -setairportpower en0 off
share|improve this answer

Your Answer


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.