Wednesday, October 2, 2013

How to connect to my NAS with my RaspberryPi




I wanted to access my DLink DNS 323 NAS from my Raspberry Pi.
Here's what I did on my stock RPI (ie: standard Raspian version installed):
  • Install Samba (smbfs is deprecated, cifs-utils replaces it)
sudo apt-get install cifs-utils
  • Install Samba Client (not really necessary, but why not)
sudo apt-get install smbclient
  • Make the directory where it will mount to.  I put mine in /mnt, but you can put it anywhere you like
sudo mkdir /mnt/DNS323
  • Edit the fstab file to add you entry:
sudo vi /etc/fstab
  • Add the following line at the end:
//192.168.0.101/Volume_1  /mnt/DNS323   cifs username=guest,password=,users,auto,user_xattr  0   0

In my case, I don't restrict access to my NAS with users and passwords so I don't care that they are in plain text or that the password is blank
  • To try it out enter:
sudo mount -a
  • and go to the mount point to see the files on the NAS
cd /mnt/DNS323
ls

---------------------------------------------------------------------

updated Oct 06/2013

The line above for the fstab file works, however, I had some trouble accessing files on my NAS in read/write mode.  In other words, I wasn't alwasy able to modify them.
  • The following line in fstab works better
//192.168.0.101/Volume_1  /mnt/DNS323   cifs guest,rw,uid=xxx,gid=yyy,iocharset=utfs,file_mode=0777,dir_mode=-777  0   0

Obviously you have to enter the uid and gif for your system (see /etc/passwd and /etc/group)

Check out my YouTube channel:   
www.youtube.com/KedarWarriner

2 comments:

  1. Hey - just messaged you on Twitter. I want to turn my DNS-323 into a cloud storage device. Is that any way/shape/form similar to what you've set up in this post?

    ReplyDelete
    Replies
    1. You'll have to be more detailed as to what you mean by a cloud storage device. The DNS-323 is a NAS (Network Attached Storage) device, so it can be seen as a cloud storage device in your home network already. If you mean you want to access it from outside your home network, then you'll have to configure your router to allow it through your firewall. But I'm not a security expert and there are all sorts of potential problems with doing that.

      Delete