Edit /etc/hosts file through web interface

Implement a simple web-editor to edit the /etc/hosts file right from the web-interface.

Currently, every time I add a host with a fixed IP, I need to start putty, open an SSH session and edit the /etc/hosts file, then log in back into the pihole-web-interface to reload the server (or do that from the console).

Would be much easier and user friendlier to have an online web editor which allows me to edit the file - would turn pihole admin interface into a one-stop-shop for me.

Could be a good-to-have feature.
Maybe combined with dhcp.leases editor as well?

We should not offer a method to directly edit /etc/hosts as this would require the web interface to have root permissions while we’re constantly looking at reducing the permissions Pi-hole needs to have.

When we implement this feature, we could add an online editor for a separate hosts file that can then be owned by user pihole.

The question is what users want. You can already edit the leases on the settings page. Having a simple text fields does not help most users, in contrast, it may even confuse them.

We see this already with, e.g. dd-wrt and other custom router software offering direct access to configured comes via the web interface. Whilst you’d expect people running a custom firmware on their routers to have a sufficiently well working understanding, you’d maybe be surprised by the number of forum posts like “please help me, I did something, now my router is broken”.

With the new web interface that is currently under development, we will make many things more convenient and also a few things more easy to be added as we’re using state-of-the-art web technology. Stay tuned for interesting things to come or join us in making the next level of your Pi-hole experience!

1 Like

I agree to most of Your reply, but:

You can already edit the leases on the settings page. Having a simple text fields does not help most users, in contrast, it may even confuse them.

What I’d like to see is an option to delete/force release of DHCP lease.
I know it can be done by manually editing dhcp,leases file but that feels like a step back in time…
To be “forced” to use console for a bit more advanced tasks makes it harder and more complicate than it has to be.
Don’t get me wrong, I really appreciate all dev’s effort and like Pi-hole as such, so it’s NOT a complain just my view of how it could more user friendly, not just linux-user friendly!

You are asking to change the wrong system and the hosts file is holy. I don’t like to put any non hostnames except fir the local system.

We have a DNS server in form of pi-hole which should provide all domainnames with a top level domain. Dnsmasq can do that for you and it is a extra config file for Dnsmasq.

1 Like

The hosts file is very limited.
It wont allow you to add other types of DNS records like for example MX for mail exchange, PTR for reverse lookup, SRV for HA/load balancing or TXT records for various purposes.