cover

14 May 2025

Sharing Directories Across Your Local Network

2m46s
CIFS
network-drive
file-sharing
linux

Whether you're trying to back up files to another computer, share a media library, or simply access your work folder from a laptop in the same house, local network file sharing is a fast and secure way to transfer data without using the internet.

In this guide, we’ll walk through setting up shared folders on a Windows machine and accessing them from a Linux device using CIFS (Common Internet File System).

Part 1: Setting Up Folder Sharing on Windows

To share a folder from your Windows machine, you need to enable network discovery and file sharing.

Step 1: Enable Sharing Settings

  1. Open Settings from the Start menu.
  1. Go to Network & Internet.
  2. Scroll down and click on Advanced network settings.
  1. Under More settings, choose Advanced sharing settings.
  1. In the Private Network section, enable the following:
  • Network discovery
  • File and printer sharing
  • Allow Windows to manage homegroup connections

💡 Make sure your current network is set to “Private.” You can do this from Settings > Network & Internet > Wi-Fi (or Ethernet) and click on the active connection. Choose Private under Network profile.

Step 2: Share a Folder

  1. Right-click the folder you want to share.
  2. Click Properties > go to the Sharing tab.
  1. Click Advanced Sharing....
  2. Check Share this folder, give it a name, and click Permissions.
  3. Add permissions (e.g., allow Everyone full access if you trust the network or only some users).
  1. Click Apply and then OK to save.

✅ Now, your folder is shared and can be accessed over the network. It will be visible under the Network section in File Explorer from other Windows machines.

Part 2: Accessing the Shared Folder from Linux

On a Linux system, you can mount the Windows shared folder using CIFS, which is part of the Samba protocol suite.

Step 1: Install CIFS Tools (if not already installed)

On Debian/Ubuntu:

Bash

sudo apt update
sudo apt install cifs-utils

On Fedora:

Bash

sudo dnf install cifs-utils

Step 2: Mount the Shared Folder

Use the mount command to connect to the Windows share. Here’s an example:

Bash

sudo mount -t cifs -o username=WINDOWS_USER,password=WINDOWS_PASSWORD,rw,uid=1000,gid=1000 //192.168.1.100/Backups /mnt/lazar-backups

What each part means:

  • -t cifs: Specifies the file system type (CIFS for Windows shares).
  • -o: Mount options, such as:
  • username=WINDOWS_USER: The Windows user account.
  • password=WINDOWS_PASSWORD: Password for that account.
  • rw: Mount the share with read/write permissions.
  • uid=1000,gid=1000: Make the mounted folder owned by your Linux user (replace 1000 with your UID/GID).
  • //192.168.1.100/Backups: The Windows share path (IP + folder name).
  • /mnt/lazar-backups: The mount point on your Linux machine (make sure this folder exists).

You can now access the files using any file manager or terminal on your Linux system.

Optional: Add Mount to fstab (Auto-Mount on Boot)

If you want the share to be mounted automatically every time you boot, add this line to your /etc/fstab:

Bash

//192.168.1.100/Backups /mnt/lazar-backups cifs username=WINDOWS_USER,password=WINDOWS_PASSWORD,rw,uid=1000,gid=1000 0 0

⚠️ Security Tip: For better security, store your credentials in a separate file (e.g., /etc/samba/creds) and change the fstab entry to use credentials=/etc/samba/creds.

Wrapping Up

With just a few steps, you can seamlessly share and access folders across Windows and Linux devices in your local network. It’s perfect for:

  • Backups
  • Media streaming
  • Project file sharing
  • File sync between machines

Happy syncing! 🐧