Skip to main content

CLI for QNAP NAS management

Project description

qnap

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 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
files ls <PATH> List files and directories
files stat <PATH> Normalized metadata plus raw QNAP fields
dump [DIR] Save raw API responses for debugging
schema Print full command schema

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-cli/config.toml ~/Library/Application Support/qnap-cli/credentials.toml
Linux ~/.config/qnap-cli/config.toml ~/.config/qnap-cli/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.

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

Project details


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.1.tar.gz (46.9 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.1-py3-none-win_amd64.whl (2.6 MB view details)

Uploaded Python 3Windows x86-64

qnap_cli-0.1.1-py3-none-manylinux_2_28_x86_64.whl (2.7 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

qnap_cli-0.1.1-py3-none-manylinux_2_28_aarch64.whl (2.6 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

qnap_cli-0.1.1-py3-none-macosx_11_0_arm64.whl (2.5 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

qnap_cli-0.1.1-py3-none-macosx_10_12_x86_64.whl (2.6 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: qnap_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 46.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","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.1.tar.gz
Algorithm Hash digest
SHA256 1b6520121fa4e942c5142dae4fea4dad6e6493dcee16173d47be4bfe73b149a3
MD5 aa04b696170e3e02e58f0c5b99b6d39a
BLAKE2b-256 67c0b4b0b7e69296afe14f0cf33a2d16212c436a7b1e40d5773d6c4550858e02

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qnap_cli-0.1.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","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.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 8b75cf1c006dad834d00c0904d6e6197303853b6cbccdd84ac991c2c297ad6d4
MD5 5aa2a16463afd8dd00e8bc2867e83427
BLAKE2b-256 0dd648b424c9afbe143242f2b3d1262dffc4da44ccbb8056a55d4b5f4a1b566f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qnap_cli-0.1.1-py3-none-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: Python 3, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","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.1-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 83e15f39e3258942d23afc720d5d3f58428b7a05538c371162e46a204f81f04b
MD5 93f40cb3cb56355af5b850a8d43856c9
BLAKE2b-256 0c19e7be0d61044b42ae83897be9d514002b3284453545cfdc6c562bb8e16b2a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qnap_cli-0.1.1-py3-none-manylinux_2_28_aarch64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3, manylinux: glibc 2.28+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","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.1-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0d5a926c85dc29ecc7b593c9bb7ea70aa86559468e2dd5165ca280b3828f30f1
MD5 4ee91d559bb509fd0df137cfb3e75859
BLAKE2b-256 51033bb9b1dfbea17b741fee364d4169b1510c0e03414f0538f4c35a63e2435f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qnap_cli-0.1.1-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","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.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cd587a81e384308373b4637ea88b9877bfcef5c3a0da213efac53f68abdd574e
MD5 f2e37f879d4b12c9f29e1c27eb7fc966
BLAKE2b-256 7989bf09f457d29c04fcf61e64fa7ec8a61202544a95a99c2d5641686bd7de8e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qnap_cli-0.1.1-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","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.1-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1beb9fee8796937825f7e294ad1bc8ee6fb62df6012a252e5bd481fb5dc5aaa4
MD5 da27dd99bb83d52b073cd5d4f836aae4
BLAKE2b-256 04dc1393284c4aa7f9ed8539bae8687b4326d9d35b49a386460e71cd40095c6e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page