FORUMS

Introducing Voices of XDA: Have Your Ideas Heard

By far the greatest assets we have at XDA-Developers are you, the developers, the eager … more

Unofficial Xposed For Lollipop Touchwiz With Flashable Zip

XDA Recognized Developer arter97 has released an unofficial build … more

YotaPhone 2 Pre-Order, Xperia Z1 Price Cut – XDA TV

Android Wear 5.1.1 OTA downloads are now available. That and much more news is … more

[FTF] Sony Xperia Z Lollipop Release

Sony rolled out a Lollipop update for Xperia Z just yesterday. If you still haven’t gotten … more
Post Reply Subscribe to Thread Email Thread

[Q] Does Android have a "hosts" file?

2nd April 2014, 10:55 PM |#1  
OP Member
Thanks Meter: 2
 
More
I was wondering if Android has a file similar to a windows hosts - a file that manually maps IP addresses to domain names.

Thanks.
 
 
3rd April 2014, 03:01 AM |#2  
Senior Member
Flag New York, NY
Thanks Meter: 258
 
More
Yes. It's in /system/etc/hosts. -- You'll need to be rooted, and remount /system as read/write to be able to modifiy it.
The Following User Says Thank You to Magamo For This Useful Post: [ View ]
11th April 2014, 09:13 PM |#3  
OP Member
Thanks Meter: 2
 
More
Quote:
Originally Posted by Magamo

Yes. It's in /system/etc/hosts. -- You'll need to be rooted, and remount /system as read/write to be able to modifiy it.

I'm actually following the instructions here:

http://www.howtogeek.com/140576/how-...ock-web-sites/

And it says "failed to copy to /system/etc/hosts: Read-only file system".

Any thoughts?
11th April 2014, 09:22 PM |#4  
Senior Member
Flag New York, NY
Thanks Meter: 258
 
More
That howto foolishly leaves out two crucial steps.
adb root
adb remount

Before you try pushing the file back to the phone. As I said, this requires your phone to be rooted, and /system to be remounted as read/write.

Sent from my SGH-T699 using Tapatalk
11th April 2014, 09:50 PM |#5  
OP Member
Thanks Meter: 2
 
More
It worked, but do I need to undo the changes? (ie, unmount, unroot before I disconnect the phone).
11th April 2014, 11:29 PM |#6  
Senior Member
Flag New York, NY
Thanks Meter: 258
 
More
You shouldn't need to, however, remounting /system as readonly is not a bad idea, it would prevent malicious apps, unless designed in just such a way from writing there. Worse comes to worse, if you can't figure out how to remount it as ro, you can reboot the phone, and that will do so.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes