Covers one-time and permanent (fstab) mounts for both protocols, credentials file for SMB, _netdev flag, multi-network NFS clients, and useful commands (showmount, umount, mount -a). Also remove stale "quotas" from the project description line. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
153 lines
3.5 KiB
Markdown
153 lines
3.5 KiB
Markdown
# MicroNAS
|
|
|
|
Lightweight web GUI to manage SMB shares, NFS exports, and users on a single home server (Proxmox LXC/VM). Runs directly on the host as a systemd service.
|
|
|
|
## Proxmox LXC setup
|
|
|
|
Use a **privileged** Debian/Ubuntu container — required for the NFS server kernel module and quotas.
|
|
|
|
On the **Proxmox host**, load the NFS kernel module before starting the container:
|
|
|
|
```bash
|
|
modprobe nfsd
|
|
echo nfsd >> /etc/modules
|
|
```
|
|
|
|
## Install
|
|
|
|
Run everything below **inside the LXC container** as root.
|
|
|
|
### 1. System dependencies
|
|
|
|
```bash
|
|
apt update
|
|
apt install -y git samba nfs-kernel-server python3 python3-venv
|
|
```
|
|
|
|
### 2. Clone the repo
|
|
|
|
```bash
|
|
git clone https://gitea.honeyy.duckdns.org/Honey/MicroNAS.git /opt/micronas
|
|
```
|
|
|
|
### 3. Python environment
|
|
|
|
```bash
|
|
python3 -m venv /opt/micronas/venv
|
|
/opt/micronas/venv/bin/pip install flask gunicorn
|
|
```
|
|
|
|
### 4. Credentials
|
|
|
|
```bash
|
|
cat > /etc/micronas.env <<EOF
|
|
MICRONAS_USER=admin
|
|
MICRONAS_PASS=changeme
|
|
EOF
|
|
chmod 600 /etc/micronas.env
|
|
```
|
|
|
|
### 5. systemd service
|
|
|
|
```bash
|
|
cp /opt/micronas/micronas.service /etc/systemd/system/
|
|
systemctl daemon-reload
|
|
systemctl enable --now micronas
|
|
```
|
|
|
|
Open `http://<lxc-ip>:5000` in your browser.
|
|
|
|
---
|
|
|
|
## Updates
|
|
|
|
```bash
|
|
cd /opt/micronas
|
|
git pull
|
|
systemctl restart micronas
|
|
```
|
|
|
|
## Network
|
|
|
|
The service binds to `0.0.0.0:5000` — accessible from any LAN device at `http://<lxc-ip>:5000`.
|
|
|
|
For HTTPS, put nginx in front as a reverse proxy.
|
|
|
|
LAN or Tailscale only — never expose to the internet.
|
|
|
|
## Dev / test
|
|
|
|
```bash
|
|
# Quick local run (no gunicorn needed, must have flask installed):
|
|
MICRONAS_USER=admin MICRONAS_PASS=secret flask --app app.py run --debug --host=0.0.0.0
|
|
```
|
|
|
|
Note: SMB/NFS/user management calls require root and the relevant daemons — run on the actual LXC for full testing.
|
|
|
|
## Auth
|
|
|
|
All routes require a login session. Go to `http://<lxc-ip>:5000` — you will be redirected to the login page automatically. Credentials come from `MICRONAS_USER` / `MICRONAS_PASS` in `/etc/micronas.env`. If `MICRONAS_PASS` is not set the app starts unprotected and logs a warning — do not do this in production.
|
|
|
|
---
|
|
|
|
## Mounting shares on a Linux client
|
|
|
|
Replace `<nas-ip>` with your LXC's IP address throughout.
|
|
|
|
### SMB (Samba)
|
|
|
|
```bash
|
|
# Install client tools
|
|
apt install cifs-utils
|
|
|
|
# One-time mount
|
|
mount -t cifs //<nas-ip>/sharename /mnt/nas -o username=youruser,password=yourpass
|
|
|
|
# Permanent — add to /etc/fstab:
|
|
//<nas-ip>/sharename /mnt/nas cifs username=youruser,password=yourpass,_netdev 0 0
|
|
```
|
|
|
|
For better security, store credentials in a file instead of putting them in fstab:
|
|
|
|
```bash
|
|
# Create /etc/nas-credentials (root-only):
|
|
cat > /etc/nas-credentials <<EOF
|
|
username=youruser
|
|
password=yourpass
|
|
EOF
|
|
chmod 600 /etc/nas-credentials
|
|
|
|
# Then in /etc/fstab:
|
|
//<nas-ip>/sharename /mnt/nas cifs credentials=/etc/nas-credentials,_netdev 0 0
|
|
```
|
|
|
|
### NFS
|
|
|
|
```bash
|
|
# Install client tools
|
|
apt install nfs-common
|
|
|
|
# One-time mount
|
|
mount -t nfs <nas-ip>:/srv/data /mnt/nas
|
|
|
|
# Permanent — add to /etc/fstab:
|
|
<nas-ip>:/srv/data /mnt/nas nfs defaults,_netdev 0 0
|
|
```
|
|
|
|
`_netdev` tells the system to wait for the network before mounting — important for both SMB and NFS so the mount doesn't fail on boot.
|
|
|
|
**Multiple networks (e.g. LAN + Tailscale):** enter both subnets space-separated in the Clients field when creating the export, e.g. `192.168.1.0/24 100.64.0.0/10`. Both get the same ro/rw setting.
|
|
|
|
### Useful commands
|
|
|
|
```bash
|
|
# List available NFS exports from the server
|
|
showmount -e <nas-ip>
|
|
|
|
# Unmount
|
|
umount /mnt/nas
|
|
|
|
# Mount all fstab entries (after editing fstab)
|
|
mount -a
|
|
```
|