Linux
- Disk / Space CMD
- Mount network share
- Vault 2 issues with Nginx Proxy not working
- π Sharing a Folder on Debian Linux via Samba
- π Mounting a Network Share for Docker on Debian
Disk / Space CMD
Disk / Space CMD
Will give the usage of the user you are logged in as
sudo du -h --max-depth=1
TheΒ df command primarily checks disk usage on a mounted filesystem. If you don't include a file name, the output shows the space available on all currently mounted filesystems. Disk space is shown in 1K blocks by default:
df -h
List All Block Devices in Linux
lsblk
lsblk
Mount network share
sudo mount.cifs //192.168.1.252/5tb /5TB -o user=USER,pass=PASS
Install CIFS
sudo apt install cifs-utilsΒ
mount.cifs //192.168.1.251/hel /mnt/share/NAS/hydra -o user=USER,pass=PASS
Vault 2 issues with Nginx Proxy not working
Check logs in Portainer - bind port already used (80)
lsof -i tcp:80
This will show whats running on that Β port
fuser -k 80/tcp
This should kill the process, but if not do the below (based on the COMMAND Name)
systemctl stop haproxy
π Sharing a Folder on Debian Linux via Samba
Last Updated: 2025-06-01
Applies To: Debian 10+, Ubuntu, other Debian-based distributions
Use Case: Share a local folder over the network for access from Windows, macOS, or Linux machines.
π§° Prerequisites
-
Debian-based Linux system
-
sudoprivileges -
Network connectivity to target devices
π§ Step 1: Install Samba
Update the system and install Samba:
π Step 2: Create a Shared Directory
Choose or create the folder to share. Example:
This creates a public share folder with loose permissions (for anonymous access).
π οΈ Step 3: Configure Samba
Edit the Samba configuration file:
Add the following to the bottom of the file:
π Tip:
force user = nobodyensures files are written as thenobodyuser, preventing permission issues.
π Step 4: Restart Samba Services
π₯ Step 5: Open Firewall (If Enabled)
For systems using ufw (Uncomplicated Firewall):
Or manually:
π§ͺ Step 6: Access the Share
From a Windows or Linux machine:
-
Open File Explorer or file manager.
-
Go to:
\\<your-debian-ip>\PublicShare
You should see the shared folder contents.
π Optional: Secure with Username/Password
To restrict access:
-
Disable guest access:
-
Create a Samba user:
-
Restart Samba:
Youβll now need a username/password to access the share.
π§Ή Troubleshooting
| Problem | Fix |
|---|---|
| Can't connect to share | Check firewall, Samba config syntax, and network IPs |
| Files not writable | Check folder permissions and force user setting |
| Authentication issues | Ensure Samba user exists and password is set via smbpasswd |
π Related
-
/etc/samba/smb.conf: Samba main configuration file -
sudo testparm: Validates Samba config -
sudo smbstatus: Shows active connections
π Mounting a Network Share for Docker on Debian
Β
π§ Overview
This guide shows how to mount a CIFS/SMB network share on a Debian-based system and use it as a volume in Docker Compose. Useful when your Docker container needs access to shared files hosted on another machine (e.g., a NAS, Windows PC, or another Linux box).
π οΈ Step 1: Install CIFS Utilities
sudo apt update
sudo apt install cifs-utils
π Step 2: Create a Mount Point
sudo mkdir -p /mnt/downloads
π Step 3: Mount the Share
sudo mount -t cifs //LORGAR/Downloads /mnt/downloads -o username=slitzer,password=blink182,vers=3.0
Replace:
//LORGAR/Downloadsβ with the remote share pathusernameandpasswordβ with valid credentialsvers=3.0β adjust based on your SMB version (2.0,3.1.1, etc.)
πΎ Optional: Persistent Mount via fstab
Edit /etc/fstab:
//LORGAR/Downloads /mnt/downloads cifs username=slitzer,password=blink182,vers=3.0,uid=1000,gid=1000 0 0
Using a secure credentials file:
# /root/.smbcredentials
username=slitzer
password=blink182
Then in /etc/fstab:
//LORGAR/Downloads /mnt/downloads cifs credentials=/root/.smbcredentials,vers=3.0,uid=1000,gid=1000 0 0
Don't forget: chmod 600 /root/.smbcredentials
π³ Step 4: Use in Docker Compose
Update your docker-compose.yml:
version: '3'
services:
myapp:
image: myapp/image
volumes:
- /mnt/downloads:/app/shared
This maps the mounted network share inside the container.
π Troubleshooting
- Check if mounted:
mount | grep downloadsordf -h - Check permissions:
ls -la /mnt/downloads - Logs:
dmesg,journalctl -xe
β TL;DR
sudo apt install cifs-utils
sudo mkdir -p /mnt/downloads
sudo mount -t cifs //REMOTE_HOST/Share /mnt/downloads -o username=...,password=...,vers=3.0
Then reference /mnt/downloads in your Docker volumes.
π§ Pro Tip: Avoid hardcoding passwords by using credential files, especially for systems in production.