I've found it really handy to be able to connect to my network storage from my Raspberry Pi but it took me a while to work out the right configuration for my setup. Here are the steps I followed:
Raspberry Pi 1 Configuration:
Install the cifs-utils package. This is the package we need to connect the the network drive sudo apt-get install cifs-utils  
Make a directory where you would like to mount the network storage:
 sudo mkdir /home/pi/NAS  
We are going to use two files to do the network drive mounting, the first file will store the network drive and mounting information and the second will hold the login credentials information:
- /etc/fstab - network drive information
 - /root/.servercred - hidden file with network credential information
 
The cifs-utils package creates a file named fstab that holds the network drive information.
Edit the fstab file and add the network location and password:
 sudo nano /etc/fstab  
To begin with you file should look something like this:
 proc           /proc      proc  defaults         0    0  
 /dev/mmcblk0p1 /boot      vfat  defaults         0    2  
 /dev/mmcblk0p2 /          ext4  defaults,noatime 0    1  
 # a swapfile is not a swap partition, so no using swapon|off from here on, use dphys-swapfile swap[on|off] for that  
Add the following line to the bottom of the fstab file:
 proc           /proc      proc  defaults         0    0  
 /dev/mmcblk0p1 /boot      vfat  defaults         0    2  
 /dev/mmcblk0p2 /          ext4  defaults,noatime 0    1  
 # a swapfile is not a swap partition, so no using swapon|off from here on, use dphys-swapfile swap[on|off] for that  
   
 //192.168.1.100/ /home/pi/NAS cifs credentials=/root/.servercred,sec=ntlmv2,iocharset=utf8,file_mode=0777,dir_mode=0777 0  
Hit ctrl-x to exit nano, then type y and hit enter to save the file.
Now we need to create the server credential information:
 sudo nano /root/.servercred  
Add your username and password to this file (including network homegroup)
 username=KLIMOVSKI\andrew  
 password=1234abcd  
If you get the error "sudo: nano: command not found" the you will need to install nano:
 sudo apt-get install nano  
Finally, attempt to mount the network drive by typing:
 sudo mount -a  
If everything worked the command should execute and you should not see any output. You can now test the network drive by navigating to the directory we created earlier.
also worth mentioning that you should do a sudo chmod 400 /root/.servercred so that your username and password are secured.
ReplyDelete