{"id":703,"date":"2011-09-11T07:36:22","date_gmt":"2011-09-11T12:36:22","guid":{"rendered":"http:\/\/www.familytidings.com\/blog\/?p=703"},"modified":"2011-09-12T19:56:46","modified_gmt":"2011-09-13T00:56:46","slug":"using-the-nas-for-home-folders","status":"publish","type":"post","link":"https:\/\/www.familytidings.com\/blog\/?p=703","title":{"rendered":"Using the NAS for Home Folders"},"content":{"rendered":"<p>[Note:  Don&#8217;t start following these directions until you&#8217;ve read this whole post.  The NFS stuff was a dead end.]<\/p>\n<p>I set up a user for myself on the NAS.  Next, I need to <a href=\"https:\/\/help.ubuntu.com\/community\/SettingUpNFSHowTo\">connect the NAS<\/a> to my home folder, so I can put the Documents, Music and Videos directories on it.  The first step is to enable NFS on the client.  In Ubuntu, install nfs-common with Synaptic.  To automount directories, install autofs, which will install autofs5.<br \/>\nSynology -> Control Panel-> User, Create, then User Home and Enable User Home Service.<br \/>\nSynology -> Control Panel -> Shared Folder, select homes, NFS Privileges, Create.  Add network segment, e.g., 192.168.1.0\/24 and read\/write.  Note mount path at bottom.<br \/>\nOn Ubuntu:<br \/>\n<code>$ sudo mount -t nfs4 nas:\/volume1\/homes \/mnt<\/code><br \/>\nmount.nfs4: mounting nas:\/volume1\/homes failed, reason given by server:<br \/>\n  No such file or directory<br \/>\n<code>$ sudo mount -t nfs nas:\/volume1\/homes \/mnt<\/code><br \/>\nor<br \/>\n<code>$ sudo mount nas:\/volume1\/homes \/mnt<\/code><\/p>\n<p>work fine, but now I&#8217;m concerned with security because NFS doesn&#8217;t validate connections by user, but by host and I don&#8217;t have common user IDs across my machines.  <\/p>\n<p>Synology has a <a href=\"http:\/\/forum.synology.com\/wiki\/index.php\/Mapping_a_Network_Drive#How_to_map_a_drive_using_a_Linux.2FUnix_Environment\">forum post on linking network drives<\/a> that uses CIFS.  I tried this:<\/p>\n<p><code>$ mkdir ~\/nas<\/code><br \/>\nAs root, edit <code>\/etc\/fstab<\/code>:<br \/>\n<code>\/\/nas\/home \/home\/me\/nas cifs user,uid=me,gid=me,rw,suid,credentials=\/home\/me\/.naspwd 0 0<br \/>\n<\/code><br \/>\nEdit <code>~\/.naspwd<\/code>:<br \/>\n<code>username=<em>nas username<\/em><br \/>\npassword=<em>nas password<\/em><br \/>\n<code># chmod 0600 ~\/.naspwd<\/code><\/p>\n<p>As me,<br \/>\n<code>$ mount ~\/nas<\/code><br \/>\nmount: wrong fs type, bad option, bad superblock on \/\/nas\/home,<br \/>\n       missing codepage or helper program, or other error<br \/>\n       (for several filesystems (e.g. nfs, cifs) you might<br \/>\n       need a \/sbin\/mount.<type> helper program)<br \/>\n       In some cases useful info is found in syslog - try<br \/>\n       dmesg | tail  or so<\/p>\n<p>dmesg says:<br \/>\n<code>CIFS VFS: No username specified<br \/>\nCIFS VFS: cifs_mount failed w\/return code = -22<\/code><\/p>\n<p>Other instructions on the Net use Samba, so I tried that.  Installed packages samba, samba-tools, smbfs, samba-doc, xsmbrowser.  (You really only need smbfs.)<\/p>\n<p>Now this works:<br \/>\n<code># sudo mount -t smbfs \/\/nas\/home ~\/nas -o username=<em>nas username<\/em>,password=<em>nas pwd<\/em><\/code><br \/>\nSo does this:<br \/>\n<code># sudo mount -t smbfs \/\/nas\/home ~\/nas -o credentials=\/home\/me\/.naspwd<\/code><\/p>\n<p>As root, edit <code>\/etc\/fstab<\/code> and change file system type from cifs to smbfs.<\/p>\n<p>(When later updating another machine, I found out it was smbfs that was needed by cifs, so you can use cifs in <code>\/etc\/fstab<\/code> if you want instead of smbfs.)<\/p>\n<p>Now, as root<br \/>\n<code># sudo mount \/home\/me\/nas<\/code><br \/>\nworks, but if I run it as me, I get<br \/>\n<code>mount error(1): Operation not permitted<br \/>\nRefer to the mount.cifs(8) manual page (e.g. man mount.cifs)<\/code><\/p>\n<p>But this is good enough to have my home directory on the Synology DiskStation automatically mapped to ~\/nas on the client.  From there, I moved my common directories (e.g., Documents, Videos, and Music) to the NAS directory and made them soft links to the NAS:<br \/>\n<code>$ cp -r ~\/Documents ~\/nas<br \/>\n$ mv ~\/Documents ~\/Documents-old<br \/>\n$ ln -s ~\/nas\/Documents ~\/.<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>[Note: Don&#8217;t start following these directions until you&#8217;ve read this whole post. The NFS stuff was a dead end.] I set up a user for myself on the NAS. Next, I need to connect the NAS to my home folder, so I can put the Documents, Music and Videos directories on it. The first step [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-703","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/703","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=703"}],"version-history":[{"count":34,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/703\/revisions"}],"predecessor-version":[{"id":706,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/703\/revisions\/706"}],"wp:attachment":[{"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}