nss-userhosts - hosts files for unprivileged users
The NSS-userhosts extension library for glibc enables unprivileged users to maintain their own /etc/hosts-like entries. Currently in an early stage, the tool is functional. Supported operating systems include Arch Linux, where users can build the package by navigating to the 'packaging' directory and executing 'makepkg'.
To activate NSS-userhosts, edit the '/etc/nsswitch.conf' file and place 'userhosts' at the beginning of the 'hosts' line. Subsequently, users can define their own hosts by creating a directory at '$HOME/.config/userhosts' and adding a file, such as 'pets.conf', containing the desired IP address and hostname mappings.
For troubleshooting, set the 'ENV NSS_USERHOSTS_LOG true' environment variable before running the program. This will generate debug messages in the standard error stream. Testing is straightforward using unprivileged containers with the 'podman' tool, facilitated by a 'justfile' for convenience. Users can start testing with the 'just test' command, assuming 'podman' and 'just' are installed.
Container testing can be further customized using the 'Containerfile'. While the project welcomes contributions via pull requests or issues on Codeberg, the developer acknowledges limited availability for development and aims to address submissions in a timely manner.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.