Urgent.News

What's breaking now, across thousands of outlets.

Tech

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.

Read the original at codeberg.org →

More in Tech

The Crash That Only Happened in Production

The crash was intermittent, production-only, and invisible to every test I ran locally. It turned out to be a data race in code a free coding model wrote for me, and the fix was a single lock.

  • Crash discovered only in production, not during local testing
  • Intermittent data race in code generated by free coding model
  • Fix involved adding mutex to ensure safe map access

More from Saturday 22 August →