Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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
1  
possible duplicate of Start/stop internet sharing from a script? –  user588 Mar 25 '11 at 2:21

2 Answers 2

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.". –  Lri May 16 '12 at 14:35

Try

networksetup -setairportpower en0 off
share|improve this answer

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.