How to Control Both Moto G and Moto E LEDs

Notification LEDs offer a great way to check for notification at a glance on the Moto G (2013) and … more

LG G3 Receives Oversharpening Fix via Modified Kernel

Nothing is perfect, as they say. No matter how alluring or seemingly perfect, … more

APKTool Updated with Android Lollipop Support

One of the beauties of Android is the level of flexibility we have over our devices. Whether … more

Lollipop Leak for Sprint Galaxy S5, TWRP for Micromax Canvas Magnus – XDA TV

Android 5.0 Lollipop has been leaked for the Sprint … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP DJRepresent

2nd April 2014, 11:55 PM   |  #1  
OP Member
Thanks Meter: 2
 
36 posts
Join Date:Joined: Apr 2010
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, 04:01 AM   |  #2  
Senior Member
Thanks Meter: 246
 
264 posts
Join Date:Joined: Oct 2012
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, 10:13 PM   |  #3  
OP Member
Thanks Meter: 2
 
36 posts
Join Date:Joined: Apr 2010
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, 10:22 PM   |  #4  
Senior Member
Thanks Meter: 246
 
264 posts
Join Date:Joined: Oct 2012
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, 10:50 PM   |  #5  
OP Member
Thanks Meter: 2
 
36 posts
Join Date:Joined: Apr 2010
It worked, but do I need to undo the changes? (ie, unmount, unroot before I disconnect the phone).
12th April 2014, 12:29 AM   |  #6  
Senior Member
Thanks Meter: 246
 
264 posts
Join Date:Joined: Oct 2012
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