Skip to main content

eznfs

eznfs is a Python 3 CLI and interactive wizard for safely adding, editing, listing, and removing Linux NFS shares in /etc/fstab. Its terminal interface uses Rich 15.0.0 for panels, tables, syntax highlighting, prompts, and progress displays.

It creates the local mount point, writes a backed-up and atomically updated fstab entry, reloads systemd, and mounts the share immediately. The default options are designed so an unavailable NFS server does not fail or indefinitely delay boot.

Source repository: github.com/MARKMENTAL/eznfs

Requirements

  • Linux with Python 3.10 or newer for source/virtual-environment installs
  • Rich 15.0.0 and its dependencies for source installs; bundled in the standalone binary
  • An NFS client helper (mount.nfs)
  • systemd for the preferred mounting path; a bounded mount fallback is available on non-systemd hosts

Install the NFS client if necessary:

# Debian / Ubuntu
sudo apt install nfs-common

# Fedora / RHEL
sudo dnf install nfs-utils

eznfs does not install packages automatically.

Install

From PyPI

After the release is published:

pipx install eznfs
# or
python3 -m pip install eznfs

From source

Create or activate a virtual environment and install the project in editable mode:

python3 -m venv .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -e .

The installer creates an eznfs entry point inside the virtual environment:

.venv/bin/eznfs --help

Run privileged commands through the virtual-environment entry point:

sudo "$PWD/.venv/bin/eznfs"

The examples below use eznfs for readability. With a virtual environment, substitute sudo "$PWD/.venv/bin/eznfs" wherever they show sudo eznfs.

Alternatively, invoke the module directly after installing its dependencies:

.venv/bin/python eznfs.py --help

Terminal appearance

Rich formatting is used for all command output when attached to a terminal. eznfs automatically selects a light or dark palette from COLORFGBG when available and falls back to the dark palette otherwise. Light terminals use darker amber, green, red, magenta, and cyan variants for contrast, along with light-background syntax highlighting.

Override the palette explicitly when needed:

EZNFS_COLOR_THEME=light eznfs list
EZNFS_COLOR_THEME=dark eznfs list
EZNFS_COLOR_THEME=auto eznfs list

When output is redirected, running in CI, or TERM=dumb, eznfs automatically uses plain text without animation. NO_COLOR is also respected by Rich; it removes color codes, although Rich may still use bold or dim attributes.

Optional shell aliases can preserve these settings through sudo. These examples assume the repository is at $HOME/eznfs:

# Virtual-environment install
alias eznfs-nc='sudo NO_COLOR=1 "$HOME/eznfs/.venv/bin/eznfs"'
alias eznfs-light='sudo EZNFS_COLOR_THEME=light "$HOME/eznfs/.venv/bin/eznfs"'
alias eznfs-dark='sudo EZNFS_COLOR_THEME=dark "$HOME/eznfs/.venv/bin/eznfs"'

# Standalone binary resolved through the current PATH
alias eznfs-nc='sudo NO_COLOR=1 "$(command -v eznfs)"'
alias eznfs-light='sudo EZNFS_COLOR_THEME=light "$(command -v eznfs)"'
alias eznfs-dark='sudo EZNFS_COLOR_THEME=dark "$(command -v eznfs)"'

Use the aliases directly because they already include sudo:

eznfs-nc list
eznfs-light list
eznfs-dark list

Adjust the repository path as needed. The light and dark aliases bypass automatic terminal detection, while command -v eznfs resolves the standalone binary through your current PATH before passing its absolute path to sudo.

Standalone binary

A PyInstaller build bundles Python, Rich, and the application into one executable. The target machine does not need Python or pip, but it still needs the Linux system tools listed under Requirements.

Build on a Linux host:

python3 -m venv .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -e '.[build]'
./build.sh

The build uses pinned PyInstaller 6.22.3, runs unprivileged smoke tests, and produces:

dist/eznfs
dist/release/eznfs-<version>-linux-<arch>.tar.gz
dist/staging/eznfs-<version>-linux-<arch>/build-info.json

Run the binary directly:

./dist/eznfs --help
sudo ./dist/eznfs

PyInstaller is not a cross-compiler. The executable is specific to the build host's architecture and glibc version, and it is not static. One-file builds also extract to a temporary directory at startup, which may be restricted on hardened systems.

Generate forge-neutral release notes and checksums after a successful build:

.venv/bin/python tools/release_notes.py

This creates dist/release/*-RELEASE_NOTES.md and dist/release/*-SHA256SUMS.txt. The tool validates build metadata and refuses to generate notes unless the smoke tests passed. It does not publish releases.

Publishing to PyPI

Install the pinned publishing tools:

.venv/bin/python -m pip install -e '.[publish]'

Build and validate the sdist and wheel without uploading:

./publish.sh testpypi --check-only

Package artifacts are written to dist/pypi/, separate from the standalone binary and release archives. The workflow runs twine check and generates SHA-256 checksums automatically.

For an interactive TestPyPI upload, use a TestPyPI API token when prompted:

./publish.sh testpypi

For noninteractive use, provide the token through the environment rather than command-line arguments:

export TWINE_USERNAME=__token__
read -rsp "API token: " TWINE_PASSWORD
export TWINE_PASSWORD
./publish.sh testpypi --non-interactive
unset TWINE_PASSWORD

After testing the TestPyPI install in a clean virtual environment, upload the same validated artifacts to production:

./publish.sh pypi --skip-build

Twine rejects attempts to reuse an existing release version, so finalize the version and metadata before uploading to production. Never commit or print API tokens.

Interactive wizard

Run without a command:

sudo eznfs

The wizard requires root and checks this before displaying any prompts. If run without sudo, it exits immediately with instructions to re-run it as root.

Interactive eznfs wizard in kitty on KDE Plasma 6

Interactive wizard in kitty on KDE Plasma 6.

The wizard asks for:

  1. NFS server IP address or hostname
  2. Absolute export path on the server
  3. Absolute local mount point
  4. Filesystem type: automatic, NFSv4, or NFSv3
  5. Retry profile: hard or soft
  6. Local user for the UID/GID permission check

The server hostname is checked immediately after entry. If it cannot be resolved, the wizard offers to re-enter it, explicitly save it for offline provisioning, or cancel.

When invoked through sudo, the wizard defaults to the invoking user from SUDO_USER/SUDO_UID, not root. It then displays a reminder to verify that the numeric UID/GID match the exported directory on the NFS server.

It then displays the exact fstab entry and offers to apply and mount it, save it without mounting, or cancel.

CLI usage

Add and mount a share

sudo eznfs add \
  --server nas.lan \
  --share /srv/nfs/media \
  --mountpoint /mnt/media

This creates /mnt/media if needed, saves the entry, reloads systemd, and mounts it immediately. It also prints the UID/GID permission reminder. Use --user USERNAME to check a specific local account:

sudo eznfs add \
  --server nas.lan \
  --share /srv/nfs/media \
  --mountpoint /mnt/media \
  --user mrkmntal

Hostname resolution

Before creating a mount point or writing fstab, eznfs checks hostname resolution through getent ahosts. Literal IP addresses skip this check, and the lookup is limited to five seconds.

If a hostname cannot be resolved, eznfs stops without changing fstab and reports the hostname along with typo, /etc/hosts, DNS, and connectivity guidance. Use --allow-unresolved only when intentionally provisioning a share before its hostname or server is available:

sudo eznfs add \
  --server offline.lan \
  --share /export/media \
  --mountpoint /mnt/media \
  --allow-unresolved

The wizard and edit command offer to re-enter the hostname or explicitly save it anyway. A hostname that resolves is still allowed when the NFS service itself is offline.

NFS UID/GID permission check

NFS permissions use numeric UID/GID values, not just matching usernames. Before relying on a share, verify the exported directory on the server:

stat -c 'uid=%u gid=%g mode=%a path=%n' /srv/nfs/media

Compare those values with the intended local user:

id mrkmntal

With root_squash, non-root UID/GID values pass through normally; only client root is mapped to the server's anonymous user. With all_squash, the server's anonuid and anongid settings control the displayed ownership instead. Client-side mount-point ownership or uid=/gid= options are not a substitute for correct server-side NFS permissions.

Select NFSv4 and save without mounting

sudo eznfs add \
  --server 192.168.1.20 \
  --share /export/backups \
  --mountpoint /mnt/backups \
  --type nfs4 \
  --no-mount

--type auto is the default and is stored as nfs, allowing normal NFS version negotiation. Use --type nfs for the generic NFS type or --type nfs4 to request NFSv4 explicitly.

Preview without root or changes

eznfs add \
  --server nas.lan \
  --share /srv/nfs/media \
  --mountpoint /mnt/media \
  --dry-run

A dry run does not create directories, modify fstab, reload systemd, or mount the server. It may perform the normal hostname-resolution check unless --allow-unresolved is supplied.

List NFS entries

eznfs list

This lists all NFS/NFSv4 entries, their mount state, whether eznfs manages them, and TCP latency to port 2049.

eznfs list output in kitty on KDE Plasma 6

eznfs list in kitty on KDE Plasma 6, showing TCP latency.

By default, each unique server is probed with six TCP connections. The column shows average latency, range, and successful attempts:

13.4 ms (5.1–24.4, 6/6)

Latency colors:

Average TCP latency Color Interpretation
< 5 ms Green Ideal
5–20 ms Yellow Acceptable
20–100 ms Orange Degraded
≥ 100 ms Red Unusable for interactive NFS work

Partial failure downgrades the color by one tier and shows the success count. Complete failure displays unreachable or unresolved.

This is TCP connection latency, not ICMP ping or actual NFS RPC latency. Firewalls, DNS, and TCP backlog limits can affect it.

Skip probes for a fast local listing:

eznfs list --no-latency

Adjust the per-attempt timeout:

eznfs list --latency-timeout 2.0

Edit a connection source

sudo eznfs edit

The editor requires root before displaying its menu. It lists every NFS/NFSv4 entry in fstab order:

1) /mnt/media
   Source: nas.lan:/srv/nfs/media
   Type: nfs | mounted | eznfs

2) /mnt/backups
   Source: 192.168.1.20:/export/backups
   Type: nfs4 | not mounted | unmanaged

q) Cancel

Select a number, enter the replacement fs_spec, review the exact old and new fstab lines, and confirm. Hostnames, IPv4 addresses, and bracketed IPv6 addresses are supported.

Only the source field is changed. The mount point, filesystem type, options, dump/pass values, comments, spacing, and eznfs marker are preserved. The update uses the normal fstab lock, timestamped backup, and atomic replacement.

eznfs edit always mounts the share after a successful edit. If it was already mounted, it is unmounted first. If the new source cannot be mounted, eznfs restores the original fstab source and remounts the old share when it was originally mounted. If the share was originally unmounted, rollback restores its fstab source but leaves it unmounted. Rollback failures are reported explicitly.

Remove an entry

sudo eznfs remove /mnt/media

Removal asks for confirmation. If the share is mounted, eznfs refuses to remove the entry unless --unmount is supplied:

sudo eznfs remove /mnt/media --unmount

For scripts and other noninteractive use:

sudo eznfs remove /mnt/media --unmount --yes

Preview a removal without changing anything:

eznfs remove /mnt/media --unmount --dry-run

Default fstab entry

# Managed by eznfs
nas.lan:/srv/nfs/media  /mnt/media  nfs  rw,hard,timeo=600,retrans=2,_netdev,nofail,x-systemd.device-timeout=10s,x-systemd.mount-timeout=15s  0  0

Option meanings:

  • rw: read/write mount.
  • hard: default retry profile; favors data integrity.
  • timeo=600,retrans=2: explicit NFS timeout and retry settings.
  • _netdev: identifies a network-dependent mount.
  • nofail: an unavailable share does not make boot fail.
  • x-systemd.device-timeout=10s: limits waiting for the mount device.
  • x-systemd.mount-timeout=15s: limits the mount operation.

Use --profile soft for a profile with soft,timeo=100,retrans=2 plus the same network and boot-safety options.

Important safety behavior

nofail protects the boot process; it does not guarantee that applications never block. A hard-mounted NFS server that disappears after mounting can still cause active I/O to hang. Soft mounts return errors sooner but failed writes can risk data inconsistency.

If the immediate mount fails, eznfs leaves the fstab entry in place and exits nonzero. The entry remains protected by nofail and the configured timeouts and can be retried later.

fstab safety

When applying changes, eznfs:

  • Requires root.
  • Refuses duplicate mount-point entries.
  • Refuses / and protected system trees such as /boot, /etc, /proc, /run, /sys, and /dev.
  • Refuses symbolic-link or regular-file mount points.
  • Escapes spaces, tabs, and backslashes for fstab.
  • Creates missing mount-point directories with mode 0755; existing directory permissions are not changed.
  • Locks fstab against concurrent eznfs edits.
  • Creates a timestamped backup before writing.
  • Atomically replaces fstab while preserving its ownership and mode.

Backups are named like:

/etc/fstab.eznfs-20261128T123456.123456.bak

Tests

Run the unit and CLI tests without root:

.venv/bin/python -m unittest discover -s tests -v
.venv/bin/python -m py_compile eznfs.py eznfs_ui.py tools/build_dist.py tools/release_notes.py tools/publish_pypi.py tests/test_eznfs.py tests/test_eznfs_ui.py tests/test_release_tools.py tests/test_publish_tools.py
git diff --check

The tests use temporary fstab files, mocked mount/systemd operations, in-memory Rich consoles, and temporary release artifacts. They do not modify the real /etc/fstab, require root, contact an NFS server, mount shares, or invoke a real PyInstaller build.

License

eznfs is released under the MIT License.

Metadata

Release files for eznfs 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eznfs 1.0.0
File Size Uploaded Provenance Actions
eznfs-1.0.0.tar.gz 104.6 kB Without provenance Details for eznfs-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for eznfs 1.0.0
File Interpreter ABI Platform Actions
eznfs-1.0.0-py3-none-any.whl Python 3 none any Details for eznfs-1.0.0-py3-none-any.whl

Total release size: 132.1 kB

Release files / eznfs-1.0.0.tar.gz

Download URL eznfs-1.0.0.tar.gz
Size 104.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6b946b90672469f380f8f3f3cbcacc4d96280e83fa216855872a58d32ae90781
BLAKE2b-256 checksum
How to use checksums
e71e3467861aef33c95a11617b7c72294357d803de6d3ac6d0d0bfb4e1850417
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / eznfs-1.0.0-py3-none-any.whl

Download URL eznfs-1.0.0-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef0f29bfa7129db40a499096b16fd8c1a97417cf2f35bd40fa04bfcaeb00aee1
BLAKE2b-256 checksum
How to use checksums
fe00259c20f81c4204c446bc3b35466c264724d6b5d804f46e0cc67fecd94023
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for eznfs 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page