Lab_nas
Access a Synology NAS from Google Colab, Linux or Windows through a NetBird mesh network, from Python or straight from bash / cmd.
Lab_nas bundles two small pieces:
NetBird— starts the NetBird client in userspace (netstack) mode and exposes a local SOCKS5 proxy. It saves the peer identity, so later runs reconnect as the same peer without asking for the setup key. If a NetBird app/service on the machine is already connected, it just uses it.Synology— a Synology File Station client: browse, search, download (files and folders as.zip) and upload, with live progress bars.
Install
pip install Lab_nas
The NetBird binary is downloaded automatically on first start (from the
official netbirdio/netbird GitHub releases) if netbird isn't installed.
How connecting works
NetBird().start() / lab_nas start tries these in order and stops at the
first that works:
- NetBird is already connected (Lab_nas's own daemon, or a NetBird app/service you set up in a terminal) → nothing to do.
- A saved identity exists → reconnect with it, no setup key needed.
- A setup key is already available (argument,
NETBIRD_SETUP_KEYenvironment variable, or Colab secret) → used without asking. - It failed (bad/expired key, peer deleted) or there was no answer within 60 seconds → you are asked to type the setup key (3 tries).
Where the identity is saved
| Platform | Folder |
|---|---|
| Colab | /content/drive/MyDrive/netbird (Google Drive) |
| Linux | ~/.config/Lab_nas/netbird (or $XDG_CONFIG_HOME/Lab_nas/netbird) |
| Windows | Documents\Lab_nas\netbird |
Change it with NetBird(config_dir=...), --config-dir, or the
LAB_NAS_CONFIG_DIR environment variable. config.json contains the peer's
private key — keep it private (careful if Documents syncs to OneDrive).
Command line (bash and cmd)
lab_nas start # connect
lab_nas status
lab_nas ls / --host 100.83.14.114
lab_nas find "*.xlsx" /home/Drive --host 100.83.14.114
lab_nas download /home/Drive/file.xlsx /home/Drive/MyFolder --dest .
lab_nas upload report.xlsx --to /home/Drive
lab_nas stop
If lab_nas isn't found, use python -m Lab_nas ... (Windows: py -m Lab_nas ...).
Set values once instead of typing them each time:
# bash
export NETBIRD_SETUP_KEY=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
export LAB_NAS_HOST=100.83.14.114
export SYNO_USER=admin
:: cmd
set NETBIRD_SETUP_KEY=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
set LAB_NAS_HOST=100.83.14.114
set SYNO_USER=admin
Missing values (like SYNO_PASS) are asked for. Run lab_nas <command> -h
for all options.
Quick start (Python / Colab)
from Lab_nas import NetBird, Synology
NetBird().start() # connect to your NetBird network
nas = Synology('100.83.14.114') # your NAS's NetBird IP
nas.login() # uses SYNO_USER / SYNO_PASS
nas.ls('/') # list shared folders
nas.find('*.xlsx', '/home/Drive') # search by name
nas.download('/home/Drive/file.xlsx') # Colab: /content, else current folder
nas.download('/home/Drive/MyFolder') # a folder arrives as MyFolder.zip
nas.upload('file.xlsx', '/home/Drive') # upload a local file
Secrets
Looked up as an environment variable first, then a Colab secret (🔑 sidebar with Notebook access on). If missing, you're asked to type it.
| Secret | Meaning |
|---|---|
NETBIRD_SETUP_KEY |
a reusable NetBird setup key |
SYNO_USER |
DSM username |
SYNO_PASS |
DSM password |
Common operations
nb = NetBird(hostname='colab', timeout=60) # peer name, seconds before asking for the key
nb.start()
nb.status() # NetBird status + proxy state
nb.log() # tail the NetBird log
nb.stop()
nas = Synology('100.83.14.114') # proxy used automatically when needed
nas.login('admin', 'password')
nas.ls('/home')
nas.find('report*', '/home', max_depth=3)
nas.download_more(['/home/a.pdf', '/home/b.pdf'])
nas.download('/home/Photos', extract=True)
nas.upload('out.csv', '/home/Drive', overwrite=True)
nas.logout()
Requirements
- Colab, Linux (amd64/arm64) or Windows (amd64/arm64).
- A NetBird network and a setup key (needed only the first time).
- A Synology NAS on your NetBird network, with an account that has File Station permission.
Notes
- Runs NetBird in netstack (userspace) mode on its own daemon address
(
127.0.0.1:41799), so notundevice is needed and a NetBird app already installed on the machine is never touched. - On Windows, if the daemon doesn't start, try cmd as Administrator.
- Synology often serves DSM with a self-signed certificate; TLS verification is disabled for the NAS session by design.
- Synology Office files (
.osheet,.odoc,.oslides) can only be opened in Synology Office — export to.xlsx/.docxon the NAS first if you need them elsewhere.
License
MIT — see LICENSE.
Release files for lab-me-nas 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lab_me_nas-0.2.4.tar.gz | 24.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lab_me_nas-0.2.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.6 kB
Release files / lab_me_nas-0.2.4.tar.gz
| Download URL | lab_me_nas-0.2.4.tar.gz |
|---|---|
| Size | 24.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a9a0010928bb3eafeda724c70051e6e37993064bbe9243344ec5d6a5d135dea
|
|
BLAKE2b-256 checksum How to use checksums |
7aa6b07bf9af44a444dbbe60382f3443b52c482ff9d2cff0472cd8ad930fc1f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logRelease files / lab_me_nas-0.2.4-py3-none-any.whl
| Download URL | lab_me_nas-0.2.4-py3-none-any.whl |
|---|---|
| Size | 26.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c25f18b28d34229a6dbc581985db3b2ef9e243edbad30ca2d8e07f8480f3a84b
|
|
BLAKE2b-256 checksum How to use checksums |
03ea5648c08735cf8f5cae6b2b659a69b4da78c82168354688d5203f21e05f02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency log