Mount Network Drive on Linux

Here's how to mount network-available storage (NAS) on a Linux box.

Get a Tool

If you mount with CIFS, you will be able to connect to more devices in a more generic way.

To enable you to mount with CIFS, you'll need a tool:

sudo apt install cifs-utils

Find the NAS

A filesystem available over the network, NAS, or network-attached storage will be available at an IP.

If this is on your local network, scan and find it.

Copy the IP for the next step.

Create a Mount Point

You can mount anwhere. /mnt is traditional. Make a spot:

sudo mkdir -p /mnt/mystuff

Mount the Drive

You have to know what the network shares are named on the NAS. I don't have a generic way to find this. It's probably the top-level folder name on the NAS. In this case, it's mystuff.

sudo mount.cifs //192.168.10.151/mystuff /mnt/mystuff -o user=myusername,uid=$(id -u),gid=$(id -g)

Options on the mount are sent with the -o flag:

  • user=myusername - for login on the share

  • pass=mypassdawg - for login on the share (or save for interactive shell)

  • uid=$(id -u),gid=$(id -g) - to allow the local user to write to the share

See it Mounted

After mounting, you can see all mounted filesystems:

more /proc/mounts

You can then change directory and browse away:

cd /mnt/mystuff
ls

Unmount? Never!

Finally, if you want to, you can unmount. cd out of the mount path, and type:

sudo umount /mnt/mystuff