Skip to main content

qnap

codecov

A CLI for QNAP NAS management. It is designed for both interactive use and automation: human-friendly tables by default, stable JSON contracts on inspection commands, and a schema command for agent introspection.

Supported platforms: Linux and macOS.

Installation

cargo install qnap

# Or run from PyPI without installing
uvx qnap-cli --help

The PyPI package provides both qnap and qnap-cli as executable names.

Or build from source:

git clone https://github.com/rvben/qnap-cli
cd qnap-cli
make install

Quick Start

# Save connection settings and password
qnap login --host nas.local --username admin

# Inspect the NAS
qnap info
qnap status
qnap volumes
qnap shares
qnap files ls /Public

# Structured output for automation
qnap status --json
qnap files stat /Public/example.txt --json

Commands

Command Description
login Save credentials and verify connectivity
info Model, firmware, hostname, serial, uptime
status CPU, RAM, temperature, uptime
volumes Storage volumes and installed disks
shares Shared folders
network Network adapters, IPs, MACs, DNS (--json)
config Show saved host, username, TLS settings, and file paths (--json)
files ls <PATH> List files and directories (--all, -r recursive, --json)
files stat <PATH> Normalized metadata plus raw QNAP fields (--json)
files find <PATH> <PATTERN> Recursive glob search (*.txt, backup*) (--json)
files mkdir <PATH> Create a directory
files rm <PATH>... Delete one or more files or directories
files mv <SRC> <DST> Move or rename a file or directory
files cp <SRC> <DST> Copy a file or directory (--overwrite)
files upload <LOCAL> <REMOTE_DIR> Upload a file or directory (--overwrite, -r recursive)
files download <REMOTE> [LOCAL] Download a file or directory (-r recursive)
dump [DIR] Save raw API responses for debugging
schema Print full command schema
completions <SHELL> Print shell completion script (bash, zsh, fish)

Global Flags

These flags work on every authenticated command, including login.

Flag Description
--host <HOST> Override the NAS host for one command. HTTPS only.
--username <USERNAME> Override the username for one command.
--insecure Skip TLS certificate verification for one command.
--secure Force TLS certificate verification for one command.
--password-stdin Read the password from stdin.

Examples:

printf '%s\n' 'secret-password' | qnap --password-stdin info
qnap --host https://nas.local --username admin status
qnap --secure volumes --json

Authentication

qnap login [--host <HOST>] [--username <USERNAME>] [--insecure | --secure]

qnap login verifies the credentials before saving anything. Host, username, and the saved TLS verification preference are stored in config.toml. The password is stored separately in credentials.toml.

The CLI requires HTTPS. Plain http:// targets are rejected. If your NAS uses a self-signed certificate, use --insecure or QNAP_INSECURE=1 explicitly.

If you do not want local password persistence, skip qnap login and provide QNAP_HOST, QNAP_USERNAME, and QNAP_PASSWORD directly when running commands.

JSON Output

The following commands support --json with stable, typed output:

  • info
  • status
  • volumes
  • shares
  • files ls
  • files stat

Highlights:

  • status --json uses numeric fields such as cpu_usage_pct, mem_total_mb, and temp_c.
  • volumes --json includes status_code, pool_id, and per-disk temp_c.
  • shares --json uses items_count as a number.
  • files ls --json uses size_bytes and modified_epoch.
  • files stat --json returns normalized fields plus a raw object for unnormalized QNAP metadata.

Use qnap schema for the full machine-readable command and output contract.

Environment Variables

Environment variables override local files.

Variable Description
QNAP_HOST NAS host, for example https://nas.local or nas.local
QNAP_USERNAME Username
QNAP_PASSWORD Password
QNAP_INSECURE 1/true/yes to skip TLS verification, 0/false/no to force verification
NO_COLOR Disable colored output

Stored Files

config.toml stores host, username, and TLS verification preference. credentials.toml stores the password separately in plaintext on the local machine.

Platform Config file Credentials file
macOS ~/Library/Application Support/qnap/config.toml ~/Library/Application Support/qnap/credentials.toml
Linux ~/.config/qnap/config.toml ~/.config/qnap/credentials.toml

Security

  • Passwords are never accepted as CLI flags.
  • HTTPS is required for NAS connections.
  • TLS verification is enabled by default.
  • credentials.toml is written atomically.
  • On Unix, credentials.toml is restricted to owner-only (0600) permissions.
  • On Unix, the config directory is tightened to owner-only (0700) permissions.
  • Symlink and non-regular-file credential targets are rejected.
  • If you do not want local password persistence, use environment variables or --password-stdin.

Shell Completions

Generate and install completions for your shell:

# Zsh — add to ~/.zshrc or drop in a $fpath directory
qnap completions zsh > ~/.zfunc/_qnap
echo 'fpath=(~/.zfunc $fpath)' >> ~/.zshrc
echo 'autoload -Uz compinit && compinit' >> ~/.zshrc

# Bash
qnap completions bash > /etc/bash_completion.d/qnap
# or for a user install:
qnap completions bash > ~/.local/share/bash-completion/completions/qnap

# Fish
qnap completions fish > ~/.config/fish/completions/qnap.fish

Compatibility

Tested against QTS 5.1.x and 5.2.x. The core authentication and file manager APIs have been stable since QTS 4.3, but qnap dump is the recommended way to capture compatibility issues from older or unusual firmware builds.

License

MIT

Releasing

Vership owns versioning, changelog generation, release commits, and tags. See the release runbook for the verified workflow and recovery policy.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qnap_cli-0.1.14.tar.gz (75.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

qnap_cli-0.1.14-py3-none-win_amd64.whl (3.0 MB view details)

Uploaded Python 3Windows x86-64

qnap_cli-0.1.14-py3-none-manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

qnap_cli-0.1.14-py3-none-manylinux_2_28_aarch64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

qnap_cli-0.1.14-py3-none-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

qnap_cli-0.1.14-py3-none-macosx_10_12_x86_64.whl (3.1 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file qnap_cli-0.1.14.tar.gz.

File metadata

  • Download URL: qnap_cli-0.1.14.tar.gz
  • Upload date:
  • Size: 75.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for qnap_cli-0.1.14.tar.gz
Algorithm Hash digest
SHA256 9be221efa8155afca4b162640ea7bb390f74f009f77f82ea8c96871cb7ed0157
MD5 2eea3f4900fc4c7e2ff2fcb9546d0b17
BLAKE2b-256 088b85d4503a724a9a2980b9a681b27040c1bfd0b883b14d333fd7e334fbeab5

See more details on using hashes here.

File details

Details for the file qnap_cli-0.1.14-py3-none-win_amd64.whl.

File metadata

  • Download URL: qnap_cli-0.1.14-py3-none-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for qnap_cli-0.1.14-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 6679a1e6262b5b30326add4948b51d8be0a77995496b8af139910db15c93ad15
MD5 49db475e7d36e38e7ab72a1de35eca04
BLAKE2b-256 ef5e01799219f300322f9ad84a33b03f48fdd5e60c8d9aea86771b169e5c9e59

See more details on using hashes here.

File details

Details for the file qnap_cli-0.1.14-py3-none-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: qnap_cli-0.1.14-py3-none-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: Python 3, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for qnap_cli-0.1.14-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5b36566ff07380cb53e2d2134e84af7fd7f396c4597ca8edf214cc091bcff2c2
MD5 03247b875c7228107011d31c886a51cb
BLAKE2b-256 b579c3ae3a602c9939f5001810a82c48a366cfcafb10abf8ee2d4be59fe55104

See more details on using hashes here.

File details

Details for the file qnap_cli-0.1.14-py3-none-manylinux_2_28_aarch64.whl.

File metadata

  • Download URL: qnap_cli-0.1.14-py3-none-manylinux_2_28_aarch64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3, manylinux: glibc 2.28+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for qnap_cli-0.1.14-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c291f0d6643b168c6f2dd62d226e6b370645800687c77b6d13301e9bc0ab6b04
MD5 0d2589bb7df76ced9ae5521ada86f6e4
BLAKE2b-256 c1fa5d9789a1f827e9a8c1a32ce3cb52be9806ceb14453df971889194b46f589

See more details on using hashes here.

File details

Details for the file qnap_cli-0.1.14-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: qnap_cli-0.1.14-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for qnap_cli-0.1.14-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d3402fce05216600130e0a56bdeeaab07d50768a26d8a3ba6288d2383b5a29ad
MD5 f525552237c370ad7294157395788913
BLAKE2b-256 dedb0cd060dbc350154fe422f3060e9b80e2619fd02e54c81cda30b91673dc5d

See more details on using hashes here.

File details

Details for the file qnap_cli-0.1.14-py3-none-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: qnap_cli-0.1.14-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for qnap_cli-0.1.14-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1eb618d32e5ae9dcb60a70c9a0234319b3c8a59d49a1038afe3ab9f114f17278
MD5 0cbb5b1183287e42291ec6e373bf283f
BLAKE2b-256 01fc063cdfbb555eb7350cf4e352bc35b94e124692b65f77b8c6230af0e287bf

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.14 This release

6 files

0.1.13

6 files

0.1.12

6 files

0.1.11

6 files

0.1.10

6 files

0.1.9

6 files

0.1.8

6 files

0.1.7

6 files

0.1.6

6 files

0.1.5

6 files

0.1.4

6 files

0.1.2

6 files

0.1.1

6 files

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