/etc/hosts on iOS

hosts, ios, networking, unix

Solution

You can't edit any files outside of your application's sandbox (without jail breaking). See this question (Is it possible to access iPhone/iPad app files without jailbreak?) for more information on viewing files in your app's sandbox. If you jailbreak your iPhone, you can access /etc/hosts in numerous ways:

- Download iFile and navigate to that directory

- Download OpenSSH and from your computer edit the contents of /etc/hosts

- Download MobileTerminal and just like on OS X, navigate to /etc/hosts with the `cd` command

I just found a way of accessing your files without jail breaking, but I have not tried it. There's an application called iFunbox that claims to allow the user to access an iPhone's root filesystem without jail breaking. Once again, I have not tried it and do not know if it works but you might want to check it out. You can download it here http://www.i-funbox.com/.

Hope this helps!

Problem

How can I edit `/etc/hosts` on my iOS device? I just do `sudo nano /etc/hosts` on OS X. Perhaps writing a small app to do it is the best way. Note that I just want to edit it on my iOS device. I'm not planning on editing it for apps in the app store.

Original source