Mount a NAS share to Raspberry (Raspbian)

Raspberry Pi Quick Start Guide

Install and configure Raspbian on the Raspberry Pi
Configure WiFi connection in Raspbian Stretch Lite on Raspberry Pi
Share a folder from Raspberry Pi and access it from Windows
Mount a NAS share to Raspberry (Raspbian)


Mount a NAS share to Raspberry can be done because of various reasons. For example you could access data stored on the NAS or you can use the NAS share as backup drive. Data on the Raspberry is stored only on a SD card and it could happen that you loose data if your SD card gets corrupt.

Mount a NAS share

To mount a NAS share you need to install cifs-utils, if it is not already installed:

sudo apt-get install cifs-utils

Then create a new folder. Into this folder you will link the contents of the share later:

sudo mkdir -vp /media/backup

In your home drive now create a credentials file. This will be used later to connect to your NAS share:

nano /home/pi/.NASCREDS

Store your credentials into this file:


Now you are ready to mount the share. This configuration is done in fstab. Open fstab with your preferred texteditor:

sudo nano /etc/fstab

To the end of the file add your mount configuration. Note that I used a tabulator as delimitter.

# device-spec	mount-point	fs-type	options	dump	pass
//IP_OF_YOUR_NAS/SHARENAME	/media/backup	cifs	credentials=/home/pi/.NASCREDS,uid=1000,gid=1000,sec=ntlm	0	01

After a reboot of your system you will be able to access your NAS share. Fstab will automatically mount your share at system boot. If you do not want to reboot your Pi, you are also able to mount the share immediately by typing:

sudo mount -a

Leave a Reply