๐ 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
No comments to display
No comments to display