HACKER Q&A
📣 terry_hc

Local hostnames without root/admin


I'm looking for a simple way to locally define hostnames for internal use, think /etc/hosts, but without the requirement of superuser privileges. Running a resolver locally, or within the LAN, falls outside the realm of "simple". The subject is primarily the web browser, so a clever browser extension for Firefox and/or Chromium would work great. If resolution could also happen outside the browser that would be a nice bonus.

Thankful for any suggestions.


  👤 kees99 Accepted Answer ✓
Supposedly you can set env variable "HOSTALIASES" to point to your private instance of /etc/hosts-like file:

https://web.archive.org/web/20160318205307/http://blog.tremi...

...but I personally never managed to make it work. Maybe some extra magic in /etc/nsswitch.conf is required (shrug)


👤 WarOnPrivacy
> As noted in the ingress, the web browser is the primary application.

In Firefox, about:networking and about:networking#dns are the http cache and dns cache. I have never considered writing values to these directly. Could there be a method for doing so within the developer console? Perhaps someone knows.

There are replies in the below link that touch on it for Chrome. The top suggestion, however, is using a socks 5 proxy server as a workaround. https://superuser.com/questions/184643/override-dns-in-firef...


👤 sim7c00
anything that could capture the traffic of another application outside of that application is likely gonna need super user privs. the ports it flows on need those to capture it, and running a program which could capture it also likely needs it.

that being said: more context would thus help. what application is making the request, and at what point do you expect to intercept or get that request? is that outside the same app or not?

edit: also, can you atleast set it up as root or does everything need to happen as user? (and the OS might also matter)


👤 terry_hc
I want to note that I mean to use such internal hostnames to reach services inside a VPN. If solutions such as IPsec or OpenVPN can somehow push and manifest host->IP correlations for the OS, as an alternative to pushing an additional DNS resolver living inside the VPN, that would also be a viable solution.