Mount a Windows/NAS Shared Folder with mount -t cifs

Attach an SMB network share to a local directory on Linux with cifs-utils so NAS or Windows files behave like local files.

LinuxnascifsmountMedium risk
Run sudo mount -t cifs //SERVER/share /mnt/nas -o username=youruser,uid=$(id -u) and enter the share password.

01Command

Command
$ sudo mount -t cifs //192.168.1.20/share /mnt/nas -o username=youruser,uid=$(id -u),iocharset=utf8

02What it does

The kernel's cifs filesystem client connects to any SMB share — a Windows PC, a Synology/QNAP NAS, or a Samba server — and presents it under the directory you choose. Setting uid=$(id -u) makes the mounted files owned by your user so you can read and write without sudo, and iocharset=utf8 keeps non-ASCII filenames intact. The mount disappears after reboot; add an entry to /etc/fstab (with credentials=filename,chmod=600) or a systemd automount to reconnect automatically.

03Risk

RiskMedium risk
Requirementscifs-utils (sudo apt install cifs-utils); kernel cifs module
!Warning: Never put the share password directly in /etc/fstab in plain sight — use a credentials file owned by root with chmod 600; also make sure the mount point directory exists first.

04Undo

Undo
$ sudo umount /mnt/nas

05Sources

  • Samba — Arch Wiki
    Arch Wiki · community · 2026-09-17
    Evidence: Covers mounting SMB/CIFS shares on Linux with cifs-utils, mount options, and fstab credentials files.
  • mount.cifs(8) — Ubuntu manual page
    Canonical · community · 2026-09-17
    Evidence: Documents mounting SMB/CIFS shares via mount -t cifs, including username, uid, and iocharset options.

Last verified: 2026-09-18 · Category: Network