Skip to main content

Command Palette

Search for a command to run...

How I Set Up a Shared Folder Between My Mac Mini and Ubuntu Machine (The Right Way)

Updated
6 min read

If you're running a mixed home lab or workstation setup — a Mac as your primary machine and a Linux box for heavy lifting — sooner or later you'll need a reliable way to share files between them without resorting to USB drives or cloud storage. Here's how I set it up cleanly using SMB, with persistent mounting and proper credential management.


The Setup

  • Mac Mini (macOS Sequoia) — acts as the file server, IP: 192.168.0.x

  • Ubuntu 24.04 — acts as the client, mounts the Mac share

  • Both on the same local network

The goal: a single Shared folder on the Mac, accessible from Ubuntu at /mnt/macmini, auto-mounted on boot.


Why SMB Over NFS or AFP?

macOS has native SMB support built-in and it's been the default since Mavericks. NFS on Mac requires extra configuration and has permission quirks. AFP is legacy and deprecated. SMB is the pragmatic choice — it works well across macOS, Linux, and Windows without additional software.


Step 1 — Enable File Sharing on Mac

On the Mac Mini:

  1. Go to System Settings → General → Sharing

  2. Toggle File Sharing ON

  3. Click the info button next to File Sharing

  4. Click Options and ensure "Share files and folders using SMB" is checked

  5. Under Windows File Sharing, enable the toggle next to your username — this stores your credentials in a format SMB can use. This step is critical and easy to miss.

⚠️ Without enabling your user account under Windows File Sharing, Ubuntu will get a Permission denied (13) error even with correct credentials. macOS quietly fails here without any warning.

Next, create and add your shared folder:

mkdir ~/Shared

Then back in the Sharing settings, click + under Shared Folders and add ~/Shared.


Step 2 — Verify What Mac Is Actually Exposing

Before mounting anything on Ubuntu, it's worth confirming exactly what share names Mac is advertising. From Ubuntu:

smbclient -L //192.168.0.x -U your_username

This lists all available shares. The share name in the output is what you'll use in your mount command — not a guess. Mac often uses the username or folder name as the share identifier, and case sensitivity matters.

Expected output looks like:

Sharename       Type      Comment
---------       ----      -------
Shared          Disk
kaustuv         Disk
IPC$            IPC

Step 3 — Install CIFS Utils on Ubuntu

sudo apt install cifs-utils

Most Ubuntu installs already have this, but worth confirming.


Step 4 — Test Mount (Before Making It Permanent)

Always test interactively first before writing to /etc/fstab:

sudo mkdir -p /mnt/macmini

sudo mount -t cifs "//192.168.0.x/Shared" /mnt/macmini \
  -o username=your_username,uid=\((id -u),gid=\)(id -g),vers=3.0

Key options explained:

Option Purpose
vers=3.0 Forces SMB3 — avoids handshake failures with modern macOS
uid=$(id -u) Maps remote files to your local user ID
gid=$(id -g) Maps remote files to your local group ID

If the mount succeeds, test it:

ls /mnt/macmini
touch /mnt/macmini/test.txt   # verify write access

Step 5 — Store Credentials Securely

Never put passwords in /etc/fstab in plain text. Use a credentials file with restricted permissions:

sudo nano /etc/cifs-credentials
username=your_username
password=your_password
sudo chmod 600 /etc/cifs-credentials

The 600 permission means only root can read it. This keeps credentials out of process listings and world-readable config files.


Step 6 — Persistent Auto-Mount via fstab

echo "//192.168.0.x/Shared /mnt/macmini cifs credentials=/etc/cifs-credentials,uid=\((id -u),gid=\)(id -g),vers=3.0,iocharset=utf8 0 0" | sudo tee -a /etc/fstab

Test the fstab entry without rebooting:

sudo umount /mnt/macmini
sudo mount -a
ls /mnt/macmini

If mount -a completes without error and you can see your files, the setup is solid.


Troubleshooting Reference

Here are the errors I hit and what actually fixed them:

mount error(13): Permission denied

Cause: SMB is enabled on Mac but the user account isn't checked under Windows File Sharing.
Fix: System Settings → Sharing → File Sharing → Options → check the box next to your username and enter your password.

mount error(2): No such file or directory

Cause: The share name in the mount command doesn't match what Mac is advertising.
Fix: Run smbclient -L //mac-ip -U username to list actual share names, then use the exact name.

SMB1 disabled warning in smbclient output

Cause: Informational only — macOS has disabled SMB1 (which is correct for security reasons).
Fix: None needed. Add vers=3.0 to your mount options and move on.

Files created on Ubuntu owned by root

Cause: Missing uid and gid mount options.
Fix: Always include uid=\((id -u),gid=\)(id -g) so file ownership maps to your local user.


Bonus — Using Tailscale IP Instead of Local IP

If you're already running Tailscale (and you should be), you can mount using the Tailscale IP instead of the local network IP:

tailscale ip   # run on Mac to get Tailscale IP

Then use that IP in your fstab entry. The advantage: the mount works whether you're on the local network or remote, without any additional configuration.


Final Thoughts

This took me longer than it should have the first time — mostly because of that silent SMB user account checkbox on Mac that causes a cryptic permission error. Once you know about it, the whole setup takes under 10 minutes.

The pattern here (SMB + credentials file + fstab) is the same approach I use in production for mounting shared network storage on Linux servers. It's reliable, auditable, and doesn't require any third-party software.

For home labs, this setup combined with Tailscale gives you seamless cross-device file access both at home and remotely — which is genuinely useful when you're moving builds, datasets, or VM images between machines.


If this helped you, feel free to share it. Always open to questions in the comments.