Mount an SMB network share on Linux
mount -t cifs attaches a NAS/Samba/Windows share to a local directory; uid/gid options make the files writable by your user.
Create the mountpoint (`sudo mkdir -p /mnt/nas`), then run the mount command with your share's username; unmount with `sudo umount /mnt/nas`.
01Command
Command
$ sudo mount -t cifs //192.168.1.10/share /mnt/nas -o username=myuser,uid=$(id -u),gid=$(id -g)02What it does
The cifs kernel client speaks SMB to NAS boxes, Samba servers and Windows shares. Passing `uid=$(id -u),gid=$(id -g)` maps remote files to your local user so you can write without root. Store the password in a credentials file (`-o credentials=/home/you/.smbcred`, chmod 600) instead of on the command line, and add an /etc/fstab entry with `noauto,x-systemd.automount` for boot-time mounting.
03Risk
!Warning: Mounting makes the share behave like local disk — an interrupted network can hang file operations. SMB1 (`vers=1.0`) is insecure and disabled on modern servers; specify `vers=2.1` or `vers=3.0` if negotiation fails.
04Undo
Undo
$ sudo umount /mnt/nas05Sources
- Samba — ArchWikiEvidence: covers mounting SMB/CIFS shares with mount.cifs and cifs-utils
- mount.cifs(8) — mount a CIFS/SMB shareEvidence: documents -t cifs mount options including credentials and uid/gid
Last verified: 2026-09-18 · Category: Files & Folders