Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I'm trying to edit the hosts file on a Kindle Fire.

I should say that I'm not interested in rooting the device (unless I have to) and am not trying to hide adverts or prevent software updates etc. I just use the device for web development and use hosts to route made up domains to a server.

I've pulled the hosts file using ADB, but I can't push it back as I'm unable to mount it with write permissions.

Is there a simple method for me to push the file using ADB without having to go through the whole process of rooting? Any simple way to get write access?

Cheers,

Matt

share|improve this question

2 Answers 2

up vote 0 down vote accepted

Short answer:

No.

Explanation:

This action would involve multiple steps:

  • re-mount /system read-write
  • write the hosts file to /system/etc/hosts
  • re-mount /system read-only

Each of the step requires root permissions, as the file belongs to system:system and usually is read-only to other "users".

share|improve this answer
    
OK. I thought that might be the case, I shall have to about rooting. Seems like a lot of hassle for something (that should be) so simple! –  Matt McDonald Mar 6 '13 at 17:20
    
That's called security. If it would be easy to circumvent, a malicious app could use that to re-direct you to fraudulent sites (e.g. having enter you credit card information and other sensitive data so they can collect them, while you think you've just entered them on a "safe place"). –  Izzy Mar 6 '13 at 17:26
    
True. But once I've enabled ADB I know I've stripped away a level of security –  Matt McDonald Mar 6 '13 at 17:30
    
But that's something the user can control (and an app cannot -- I never saw an app that can plug in a USB cable, and the USB Debugging setting should also be impossible to "switch" by an app). -- If you want to discuss security, please don't do so here (we are not a forum), but rather in chat (as soon as you have the required rep of 20) or check e.g. at the XDA developers forum. Thank you :) –  Izzy Mar 6 '13 at 17:33

No, you cannot edit the host file without root privileges.

But, if you have access to the internet connection on which your kindle in connecting, you can modify DNS entries there. Your kindle first looks at its host file, then asks the DNS server to resolve a hostname. Provided you have admin privileges somewhere in the chain, you can insert your own record; Since you don't have admin access on the localhost (Kindle), you go further up the chain to a link where you do have admin rights.

If you are going over Cell Data or are on a wifi network that you don't own, you could instead set up a VPN to a network to which you do have full rights. Then set up whatever DNS records you want (in the hosts file of the VPN server, or some other method). When connected to a VPN, your device should query the DNS server over VPN, thus giving you control once more.

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.