πŸ–§ Samba (SMB) Setup Guide β€” MiniPC ↔ Main PC

This guide explains how to share folders between two computers using Samba (SMB) β€” ideal for Linux ↔ Windows interoperability.


βš™οΈ 1. Install Samba on the MiniPC (server)

1
2
sudo apt update
sudo apt install -y samba

πŸ“ 2. Create a shared folder

1
2
3
sudo mkdir -p /srv/samba/share
sudo chown -R youruser:youruser /srv/samba/share
sudo chmod -R 775 /srv/samba/share

(Replace youruser with your actual username β€” same UID 1000 on both PCs.)


🧾 3. Configure Samba

Edit the configuration file:

1
sudo nano /etc/samba/smb.conf

Append this section at the end:

[shared]
   path = /srv/samba/share
   browseable = yes
   read only = no
   guest ok = no
   create mask = 0664
   directory mask = 0775
   valid users = youruser

Save and exit (Ctrl + O, Enter, Ctrl + X).


πŸ”‘ 4. Add your user to Samba

1
2
3
sudo smbpasswd -a youruser
sudo smbpasswd -e youruser
sudo systemctl restart smbd

πŸ”₯ 5. Allow Samba through the firewall (LAN only)

1
sudo ufw allow from 192.168.1.0/24 to any app Samba

🧩 6. Connect from your Main PC

πŸ–₯️ If main PC is Linux

Install CIFS utilities:

1
sudo apt install -y cifs-utils

Mount the share:

1
2
mkdir -p ~/mnt/minipc-smb
sudo mount -t cifs //192.168.1.50/shared ~/mnt/minipc-smb -o username=youruser,uid=$(id -u),gid=$(id -g)

Unmount:

1
sudo umount ~/mnt/minipc-smb

Make persistent (optional) by adding to /etc/fstab:

# Format: //<server>/<share> <mountpoint> cifs <options>
//192.168.1.50/shared /mnt/minipc-smb cifs username=youruser,password=YOURPASSWORD,uid=1000,gid=1000,_netdev 0 0

πŸͺŸ If main PC is Windows

  1. Open File Explorer and type in the address bar:
    \\192.168.1.50\shared
  2. Enter your Samba username/password.
  3. (Optional) Right-click β†’ β€œMap Network Drive…” to make it permanent.

πŸ§ͺ 7. Test your setup

On MiniPC:

1
ls -ld /srv/samba/share

On main PC:

1
echo "test" > ~/mnt/minipc-smb/test.txt

Or create a new file in File Explorer if on Windows.


πŸ› οΈ Troubleshooting

IssueCauseFix
Permission deniedOwnership mismatchsudo chown -R youruser /srv/samba/share
Network path not foundWrong IP or firewallCheck IP, sudo ufw status, restart Samba
Slow transfersProtocol mismatchAdd mount option vers=3.0
Windows login failsWrong domain syntaxTry .\youruser as username
Guest access failsGuest disabledEnable guest ok = yes (not recommended)

πŸ”’ Security Tips

  • Disable guest access unless absolutely necessary.
  • Restrict subnet access with UFW.
  • Use per-user credentials.
  • Do not expose ports 445 or 139 to the Internet.

βš™οΈ Bonus β€” Connect via GUI (GNOME/KDE)

In your file manager:
Other Locations β†’ Connect to Server β†’ smb://192.168.1.50/shared
Bookmark it for quick access.


Last updated: 2025-11-01