This is actually a compilation of answers and my own expirience.
So, get/install a copy of ADB, then type
adb devices -l # make sure your gadget is listed
adb shell # run a shell there
su # become the root (don't miss confirmation request!)
mount -o rw,remount /system # allow to write
vi /system/etc/hosts ## edit the file in place - do what you whant, then ...
Unless I missed something, that is not possible. Without root access only the mechanism of flashing an update (via recovery or OTA) can modify /system. To be accepted, such an update archive must be signed with the same key as the ROM – which is something only the developer of the ROM (here: the LOS team) can do.
There might be a way via a custom recovery ...
It is possible to use a VPN profile* to affect hostname resolution. There are a number of apps now available on the Play Store that provide a convenient way to do this, such as Hosts Go. Note that, since this technique requires the use of a VPN profile, you won't be able to use an actual VPN in conjunction with this technique.
*As of Android 4.0 (API Level ...
If you encrypt the hosts file, the system won't be able to read the file, so it won't work any more. But there's no need: since you need root access to edit the hosts file anyway, any app that you don't grant root access won't be able to edit the file.
If you want to redirect www.youtube.com to 127.0.0.1 you have to add it exactly that way to your hosts files.
However you only redirected the main domain youtube.com to 127.0.0.1. not the subdomain www.youtube.com. Note that this does not affect subdomains. If you want to cut of Youtube completely you have to add every subdomain to your hosts file.
So, how can I persuade Termius (free version) to understand local network host names?
In fact you have to persuade Android OS, not a specific app. Resolving hostnames is handled by Android's C library to which apps are linked through APIs at the time of compiling.
On the PC I can simply issue the command putty fred@servername and I can login without ...
You cannot do this without root access. The instructions given in that link are conceptually wrong to begin with. The fact that he was able to push a file into system partition implies that he had elevated privilege to remount system partition and write into it. Clearly, the instructions cannot fit under "Non root method" category.
If you are into blocking ...
Step by Step
Don’t Create the AVD with Google Play image.
Use for example Google APIs Intel x86 Atom System Image.
Start the emulator with the following command…
emulator.exe –avd <avd name> -writable-system
C:\Users\ilyas.mamun\AppData\Local\Android\Sdk\emulator>emulator.exe -avd Pixel_API_25 -writable-system
There is an other way to manipulate the /etc/hosts (You need a Linux machine )
Use the system.img which come from Google
go to your Android SDK home
find the right system.img for your emulator
sudo mount -w system-images/android-25/google_apis/x86_64/system.img
edit the /etc/hosts
sudo vi /mnt/etc/hosts
sudo umount /mnt
Create an ...
Ad blockers do not work in Nougat until the developers make an update. A beta version of AdAway does the trick but requires to check the new "Systemless mode" in Preferences screen.
Other ad blockers will probably implement similar solutions
This is marked Community Wiki for others to contribute. The explanation is not fully ...
Make sure you turn off Data Saver and any proxies.
From the Google Chrome Support Page:
"If you're using Data Saver, keep in mind that:
• Changes you made to your /etc/hosts file won't work."
To expand on the update that was made by the OP:
Chrome stores its own DNS cache for sites that you have visited. This cuts down on DNS resolution time when browsing sites that you have recently visited. However, this happens before the hosts file is checked for DNS resolution (so your new hosts entries will not be checked if they are in the Chrome DNS). ...