| Tested on | Ubuntu 25.04 (Plucky Puffin) |
|---|---|
| Applies to | Ubuntu |
| Privilege | sudo or root |
| Scope | Mount a network drive on Ubuntu over SMB/CIFS or NFS, including cifs-utils, a mount point, credentials safely, fstab entries, and browse shares in the Files app. |
| Related guides | Configure autofs on Linux Mount network storage with SSHFS |
Ubuntu can mount a network drive the same way Windows “maps” a share: you attach a remote folder to a local path such as /mnt/nas and read or write files through it. Most home and office setups use SMB/CIFS (Samba, NAS vendors, Unraid) or NFS (Linux file servers).
This guide covers mounting a network drive on Ubuntu from the terminal and the Files app: install cifs-utils, mount SMB shares with a credentials file, mount NFS exports, make mounts survive reboots with /etc/fstab, and unmount safely. I stood up a dummy Samba and NFS server on the same Ubuntu 25.04 host (glc-netshare and glc-public on 127.0.0.1) so every command below has real output. Swap 127.0.0.1 for your NAS IP or hostname.
chmod 600). Do not put plain-text passwords in /etc/fstab or shell history when you can avoid it.
Quick command summary
| Task | Command |
|---|---|
| Install SMB client tools | sudo apt install -y cifs-utils smbclient |
| Install NFS client tools | sudo apt install -y nfs-common |
| List SMB shares | smbclient -L //SERVER -U username |
| List NFS exports | showmount -e SERVER |
| Create mount point | sudo mkdir -p /mnt/nas && sudo chmod 755 /mnt/nas |
| Mount SMB (one-off) | sudo mount -t cifs //SERVER/SHARE /mnt/nas -o credentials=/root/.smbcredentials,uid=$(id -u),gid=$(id -g) |
| Mount NFS (one-off) | sudo mount -t nfs SERVER:/export/path /mnt/nas |
| Verify mount | findmnt /mnt/nas or df -hT /mnt/nas |
| Unmount | sudo umount /mnt/nas |
| fstab + apply | Edit /etc/fstab, then sudo mount -a |
What you are mounting
| Protocol | Typical server | Ubuntu package | Mount type |
|---|---|---|---|
| SMB / CIFS | Windows, Samba, Synology, Unraid | cifs-utils |
cifs |
| NFS | Linux NAS, ESXi datastore, backup server | nfs-common |
nfs or nfs4 |
SMB URLs look like //192.168.0.10/backups. NFS paths look like 192.168.0.10:/srv/backups. WebDAV (davfs2) and SSHFS are other options; this article focuses on SMB and NFS because those are what most “map network drive” guides target.
If you already export folders from an Ubuntu server, see how to set up a NAS server on Ubuntu for Samba and NFS on the server side.
Prerequisites
On the Ubuntu client:
Install the SMB and NFS clients with
apt; these packages provide mount.cifs,
smbclient, and the NFS mount helpers used below.
sudo apt update
sudo apt install -y cifs-utils nfs-common smbclientOn Ubuntu 25.04:
cifs-utils:
Installed: 2:7.2-2ubuntu0.1
nfs-common:
Installed: 1:2.8.2-2ubuntu1You also need:
- The server hostname or IP (for example
192.168.0.4ornas.local). - The share or export name (for example
glc-netshare). - For authenticated SMB: a username and password allowed on that share.
- A local mount point directory—create it before you mount, same idea as mounting a USB drive.
Use sudo for system-wide mounts under /mnt or /media.
See check Ubuntu version if you are unsure which release you are on.
Lab setup used for testing (optional)
To reproduce my session without external hardware, I created a dummy share on the same machine:
sudo mkdir -p /srv/glc-netshare /srv/glc-public
echo 'Hello from dummy network drive' | sudo tee /srv/glc-netshare/welcome.txtSamba shares glc-netshare (authenticated) and glc-public (guest read-only) were added to /etc/samba/smb.conf, and NFS exported /srv/glc-netshare to 127.0.0.1 in /etc/exports. You do not need this on a normal desktop—point commands at your real NAS instead.
Discover shares on the server
SMB: list share names
smbclient -L 192.168.0.4 -U glcshareWhen prompted for a password, enter the SMB account password. On my host:
Sharename Type Comment
--------- ---- -------
glc-netshare Disk
glc-public Disk
IPC$ IPC IPC Service (mail server (Samba, Ubuntu))Use the Sharename column in your mount command: //192.168.0.4/glc-netshare.
NFS: list exports
Use showmount -e to ask the server which paths it exports. For more
client-side discovery methods, see
how to list NFS shares and mount points.
showmount -e 127.0.0.1Export list for 127.0.0.1:
/srv/glc-netshare 127.0.0.1Your server may export to * or a subnet instead of a single IP.
Mount a network drive on Ubuntu (SMB / CIFS)
Step 1: Create a mount point
sudo mkdir -p /mnt/glc-netshare
sudo chmod 755 /mnt/glc-netshareStep 2: Store credentials (recommended)
The file must remain readable only by root. The
Linux file-permissions guide explains why
mode 600 grants read/write access to the owner and no access to the
group or others.
sudo install -m 600 -o root -g root /dev/null /root/.smbcredentials
sudo nano /root/.smbcredentialsContents:
username=glcshare
password=YourPasswordHere
domain=WORKGROUPdomain= is optional for many home NAS units.
Step 3: Mount the share
sudo mount -t cifs //127.0.0.1/glc-netshare /mnt/glc-netshare \
-o credentials=/root/.smbcredentials,uid=$(id -u),gid=$(id -g),file_mode=0664,dir_mode=0775Verify:
findmnt /mnt/glc-netshare
cat /mnt/glc-netshare/welcome.txtTARGET SOURCE FSTYPE OPTIONS
/mnt/glc-netshare //127.0.0.1/glc-netshare cifs rw,relatime,vers=3.1.1,...,uid=1000,forceuid,gid=1000,forcegid,...
Hello from dummy network driveuid= and gid= make files appear owned by your login user instead of root.
Guest read-only SMB mount
For a public share that allows guests:
sudo mkdir -p /mnt/glc-public
sudo mount -t cifs //127.0.0.1/glc-public /mnt/glc-public -o guest,ro,uid=$(id -u),gid=$(id -g)
cat /mnt/glc-public/public.txtpublic share fileWrong password (real error)
This is what I saw with a bad password:
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)Fix the credentials file or test with smbclient -L //SERVER -U user%pass before mounting again.
Write permission gotcha
My first mount could read but not create files until the server export was owned by the Samba user:
tee: /mnt/glc-netshare/from-client.txt: Permission deniedAfter changing the server-side owner with chown, this worked:
echo 'written from client mount' > /mnt/glc-netshare/from-client.txt
cat /mnt/glc-netshare/from-client.txtwritten from client mountOn a NAS you usually set permissions in the vendor UI instead of SSH.
Older SMB servers
If negotiation fails, pin an older dialect:
sudo mount -t cifs //SERVER/SHARE /mnt/nas -o credentials=/root/.smbcredentials,vers=3.0,uid=$(id -u),gid=$(id -g)findmnt then shows vers=3.0 in the options list.
Mount a network drive on Ubuntu (NFS)
NFS fits Linux-to-Linux shares and many NAS “NFS export” toggles.
sudo mkdir -p /mnt/glc-nfs
sudo mount -t nfs 127.0.0.1:/srv/glc-netshare /mnt/glc-nfs
findmnt /mnt/glc-nfs
cat /mnt/glc-nfs/welcome.txtTARGET SOURCE FSTYPE OPTIONS
/mnt/glc-nfs 127.0.0.1:/srv/glc-netshare nfs4 rw,relatime,vers=4.2,...
Hello from dummy network driveCheck space:
Check mount-point usage and filesystem types with df; the df and du covers -h, -T, and filtering pseudo-filesystems.
df -hT /mnt/glc-nfsFilesystem Type Size Used Avail Use% Mounted on
127.0.0.1:/srv/glc-netshare nfs4 58G 42G 14G 76% /mnt/glc-nfsFor export options and server tuning, see NFS mount options examples.
Mount permanently with /etc/fstab
Edit fstab when you want the network drive available after every boot.
sudo cp /etc/fstab /etc/fstab.bak.$(date +%F)
sudo nano /etc/fstabSMB example:
//192.168.0.4/glc-netshare /mnt/glc-netshare cifs credentials=/root/.smbcredentials,uid=1000,gid=1000,file_mode=0664,dir_mode=0775,_netdev,x-systemd.automount 0 0NFS example:
192.168.0.4:/srv/glc-netshare /mnt/glc-nfs nfs _netdev,x-systemd.automount 0 0| Option | Why |
|---|---|
_netdev |
Wait for networking before this mount; avoids hanging early boot when the NAS is off |
x-systemd.automount |
Mount on first access instead of blocking boot |
credentials= |
Keeps passwords out of fstab |
Test before reboot:
sudo umount /mnt/glc-netshare /mnt/glc-nfs 2>/dev/null || true
sudo mount -a
cat /mnt/glc-netshare/welcome.txtHello from dummy network driveFor systemd .mount units instead of fstab, see mount a partition using systemd.
Map a network drive in the Ubuntu GUI (Files)
On Ubuntu Desktop:
- Open Files (Nautilus).
- Click Other Locations in the sidebar.
- At Connect to Server, enter
smb://192.168.0.4/glc-netshareornfs://192.168.0.4/srv/glc-netshare. - Click Connect and enter SMB credentials when asked.
The share appears in the sidebar for your session. GNOME typically mounts it under /run/user/$(id -u)/gvfs/. That is fine for interactive use; use /mnt plus fstab when you need a fixed path for scripts, Docker bind mounts, or servers.
Install gvfs-backends if the Connect to Server dialog lacks SMB:
sudo apt install -y gvfs-backendsUnmount a network drive
sudo umount /mnt/glc-netshareConfirm:
findmnt /mnt/glc-netshare || echo "not mounted"not mountedIf you see target is busy, use
lsof on the mount point to identify which
process still has a file open, then close that process cleanly. Lazy
unmount (sudo umount -l) detaches the tree while processes finish—use
only when you understand leftover handles may still hold files open.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
mount: /mnt/nas: unknown filesystem type 'cifs' |
cifs-utils missing |
sudo apt install cifs-utils |
mount error(13): Permission denied |
Bad credentials or no guest access | Test with smbclient; fix credentials file |
mount.nfs: access denied |
Client IP not in server export | Adjust NAS NFS export / /etc/exports |
No such file or directory for mount point |
Directory missing | sudo mkdir -p /mnt/nas |
| Boot hangs on NAS mount | fstab without _netdev |
Add _netdev and x-systemd.automount |
| Files owned by root on SMB | Missing uid/gid options |
Add uid=$(id -u),gid=$(id -g) to mount options |
| Can read but not write CIFS | Server-side ownership | Fix export permissions on NAS or Samba force user |
References
Summary
To mount a network drive on Ubuntu, install cifs-utils for SMB or nfs-common for NFS, create a mount point under /mnt, and run sudo mount -t cifs //server/share /mnt/nas with a root-only credentials file. Use showmount and smbclient -L to discover exports before you mount. For mounting a network drive permanently, add a line to /etc/fstab with _netdev and test with sudo mount -a. The Files app can connect via Other Locations → Connect to Server when you prefer a GUI over the terminal.
Frequently Asked Questions
What is the difference between mounting SMB and NFS on Ubuntu?
SMB/CIFS is the Windows-style share protocol (NAS boxes, Samba, Unraid). NFS is common on Linux servers and high-throughput LAN storage. Ubuntu uses mount -t cifs for SMB and mount -t nfs for NFS; pick the protocol your server exports.
What package do I need to mount a Windows or Samba share on Ubuntu?
Install cifs-utils with sudo apt install cifs-utils. That provides mount.cifs. For NFS shares, install nfs-common. Use smbclient to list available SMB share names before you mount.
How do I mount a network drive permanently on Ubuntu?
Add a line to /etc/fstab with the UNC or NFS export, mount point, filesystem type, options, and 0 0 dump/pass fields. Include _netdev so boot does not hang if the server is offline, and store SMB passwords in a root-only credentials file—not in fstab in plain text.
Why does mount.cifs return Permission denied?
Wrong username or password, a share that rejects guests, or missing credentials are the usual causes. On Ubuntu 25.04 a bad password produced mount error(13): Permission denied. Verify with smbclient -L //server -U user%pass before mounting.
Can I map a network drive on Ubuntu without the terminal?
Yes. Open Files, go to Other Locations, click Connect to Server, and enter smb://server/share or nfs://server/export. GNOME mounts the share under /run/user/UID/gvfs/ for the session. Terminal mounts under /mnt or /media are easier to script and persist with fstab.
How do I unmount a network drive on Ubuntu?
Run sudo umount /mnt/your-mount-point. If the target is busy, close files and shells using that directory, or use sudo umount -l for a lazy unmount when you understand the risk. GUI mounts disappear when you click the eject icon in Files.
What mount options fix UID and file permission issues on CIFS?
Add uid=YOUR_UID,gid=YOUR_GID,file_mode=0664,dir_mode=0775 so files look owned by your desktop user. If writes still fail, fix ownership on the Samba server export path or ask the admin which user the share expects.
Should I use 127.0.0.1 or the LAN IP to mount a NAS?
Use the NAS or file server LAN address (for example 192.168.0.10), not 127.0.0.1, unless you are deliberately testing a share on the same machine. Replace 127.0.0.1 in lab examples with your server IP or hostname.

