Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Even though I don't have administrative privileges, can I block Internet connection on my Mac OS 10.8 machine, through the terminal?

I want to do this because I am too lazy to disconnect ethernet cable from my machine to check one of my apps in offline mode.

I have found that for Windows we have: ipconfig release and ipconfig renew commands for the same task.

Do we have any alternatives for those in Mac or any better solution to achieve it?

share|improve this question
    
Those commands require administrative privileges on Windows. –  jordanm Dec 28 '12 at 6:45
    
ok.. so is there any alternative way to do it in mac without administrative privileges? –  Miraaj Dec 28 '12 at 8:35
3  
No, not without administrative privileges. Think about it - if you could do that as a non-administrator, it'd be easy for some malware to alter your network settings at will. –  Jenny D Dec 28 '12 at 9:00
    
ok.. got your point.. but this also means that I need to disconnect ethernet cable from my machine to check one of my apps in offline mode.. it is very difficult for lazy guy like me :-( –  Miraaj Dec 28 '12 at 12:46
    
If it is your machine, is it purely a security issue that keeps you from getting admin privileges? Why would you not have these priveledges? I am unfamiliar with OSX but I would imagine I would use a suid file (executable or script) to achieve what is impossible for a non-admin user. –  humanityANDpeace Dec 28 '12 at 18:19

1 Answer 1

Since it won't be possible to do it as a normal user without special settings. (A normal user should not be able to break the system by default...) If you can convince the administrator that you need to do it, they can add the relevant command for your user to the sudoers file... (Looks like you basically want the DHCP client to restart). Seems like you'll need access to the ipconfig command. (sudo ipconfig set en0 NONE; sudo ipconfig set en0 DHCP (replace en0 with your ethernet interface as reported by ifconfig) should do it...)

You might also want to check if there is a group that you can be added to to allow you to access network settings...

Looks like another method is to set up multiple network "Locations" (admin will need to do it) and you can then switch between them using scselect, seemingly without admin rights...

The administrator should be able to limit you to only those commands in su.

(Some of this info comes from a superuser post I found (but can only access via Google cache where I am currently..))

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.