I have successfully rooted my Samsung Galaxy Mini (android 2.2.1) and thought, that I could change anything (as root usually can).
I would like to change the hosts file on the android, to include some local addresses. However, I still get the message that I do not have permission to do that. I tried following options:
adb push /path/to/my/new/hosts /system/etc
... and I got the response Read-only file system
.
directly in the shell on the phone. But this didn't work either. I can do su
in the console, but cannot change the file.
Isn't it strange, that as super user I am not allowed to change some files?
If your device is rooted, all you would have to do is to download a file explorer ( such as ES File Explorer File Manager - Android Apps on Google Play ) give it super user permission and enable the in-app setting which makes system files writable. You can then use the file explorer to replace or edit the hosts file.
The hosts file on Android devices is located in the '/etc/hosts' folder. This file is located in a read-only filesystem for security reason, it cannot be modified.
On non-rooted phone you cannot actually edit hosts file but it's possible to use VPN apps like Virtual Hosts or Personal DNS Filter (both are open-source, I've no affiliation with either) which intercept DNS traffic and look up a custom hosts file before making queries to configured upstream DNS server.
You have root, but you still need to remount /system to be read/write
$ adb shell $ su $ mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
Go here for more information: Mount a filesystem read-write.
adb shell su mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
This assumes your /system is yaffs2 and that it's at /dev/block/mtdblock3 the easier/better way to do this on most Android phones is:
adb shell su mount -o remount,rw /system
Done. This just says remount /system read-write, you don't have to specify filesystem or mount location.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With