Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bAndie91/libnss_homehosts
Linux NSS library supports ~/.hosts
https://github.com/bAndie91/libnss_homehosts
Last synced: 16 days ago
JSON representation
Linux NSS library supports ~/.hosts
- Host: GitHub
- URL: https://github.com/bAndie91/libnss_homehosts
- Owner: bAndie91
- License: agpl-3.0
- Created: 2016-10-19T10:10:48.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-12-15T10:58:28.000Z (almost 3 years ago)
- Last Synced: 2024-08-01T03:29:10.381Z (3 months ago)
- Language: C
- Size: 48.8 KB
- Stars: 29
- Watchers: 5
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# libnss_homehosts
Linux NSS library supporting per-user hosts resolution using `${XDG_CONFIG_HOME}/hosts` or `~/.hosts`
# Install
* Compile the code:
```bash
$ make
```
* Install the resulting library:
```bash
$ sudo make install
```
* Preprend the NSS module to the hosts line of `/etc/nsswitch.conf`:
```text
hosts: homehosts files dns
```# Uninstall
* Uninstall the library:
```bash
$ sudo make uninstall
```
* Remove the added module from `/etc/nsswitch.conf`.# Usage
* Create `~/.hosts` file and put some host names in it like `/etc/hosts`:
```text
127.0.0.1 myhost.example.net
```
* Check it
```bash
$ getent hosts myhost.example.net
$ ping myhost.example.net
```
Note that looking up the using `host` or `nslookup` will not work as these tools query DNS directly, sidestepping NSS.# Performance
It is better to have FQDN as in `/etc/hosts`, as well in `~/.hosts` files, eg.
198.18.1.1 frodo.baggins.theshire
instead of
198.18.1.1 frodo
in order to avoid _dns suffix-list_ expansion by libresolv when unneccessary.
Refer to `ndots` option at resolv.conf(5).
# issues
Please submit issues via PR to some file `.txt` or `.md` on `issues` branch.