Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,741,492 Members 39,554 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
DJRepresent
Old
#1  
Member - OP
Thanks Meter 1
Posts: 31
Join Date: Apr 2010
Smile [Q] Does Android have a "hosts" file?

I was wondering if Android has a file similar to a windows hosts - a file that manually maps IP addresses to domain names.

Thanks.
 
Magamo
Old
#2  
Senior Member
Thanks Meter 221
Posts: 244
Join Date: Oct 2012
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.
TeamApexQ -- irc.freenode.net/#apexqtmo
The Following User Says Thank You to Magamo For This Useful Post: [ Click to Expand ]
 
DJRepresent
Old
#3  
Member - OP
Thanks Meter 1
Posts: 31
Join Date: Apr 2010
Quote:
Originally Posted by Magamo View Post
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?
 
Magamo
Old
#4  
Senior Member
Thanks Meter 221
Posts: 244
Join Date: Oct 2012
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
TeamApexQ -- irc.freenode.net/#apexqtmo
 
DJRepresent
Old
#5  
Member - OP
Thanks Meter 1
Posts: 31
Join Date: Apr 2010
It worked, but do I need to undo the changes? (ie, unmount, unroot before I disconnect the phone).
 
Magamo
Old
#6  
Senior Member
Thanks Meter 221
Posts: 244
Join Date: Oct 2012
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.
TeamApexQ -- irc.freenode.net/#apexqtmo
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


TRENDING IN THEMER...