Announcement

Collapse
No announcement yet.

AutoMounting Multiple Shared Drives using Fstab and smbcredentials

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    I didn't change the ownership or permissions on my mount point (/mnt/Shares), it was done by itself. The shares themselves on the server are 'nobody/nogroup', which I did set thru chown and the last two lines of my Shares section of my smb.conf:
    Code:
    [Shares]
        path = /home/share
        browseable = yes
        read only = no
        guest ok = yes
        create mask = 0755
        directory mask = 0755
        force user = nobody
        force group = nogroup
    I should also point out that everything I want to share publicly is in '/home/share' on the server. Videos, Music, eBooks, Audio Books. Each has their own folder and sub-folders
    Last edited by Buddlespit; Jan 06, 2014, 05:44 PM.
    I do not personally use Kubuntu, but I'm the tech support for my daughter who does.

    Comment


      #17
      Originally posted by mbwd1 View Post
      So maybe I should create a "Shares" folder inside /mnt, point all of my samba shares there, and then change ownership of that folder? Is that how its supposed to work? Or is it appropriate/acceptable to change the ownership of /mnt?
      You certainly may change the ownership of /mnt if you want too, but it's non-standard. Personally, for my own sanity, I use a folder named "/shared" to hold shared files AND permanently shared mounts on all my computers (many) so I always know what's being distributed this way. You could put it under /mnt or /media if you wanted as well.

      Please Read Me

      Comment


        #18
        Ok, now I'm truly lost. I created /mnt/Shares. I changed my /etc/fstab to automount the right locations (i.e., /mnt/Shares instead of /mnt). All that worked. Then I changed the permissions on /mnt/Shares to mbwd1 instead of root. But the samba shares that mount on /mnt/Shares are still read-only.

        WTF? I can't figure out what settings are off here.

        I checked the "ls -la /mnt/Shares/VIDEO and got this:

        Code:
        drwxr-xr-x  6 root root      0 Jan  5 09:45 .
        [B][COLOR="#FF0000"]drwxr-xr-x  6 mbwd1 mbwd1   4096 Jan  6 19:53[/COLOR][/B] ..
        drwxr-xr-x  2 root root      0 May 28  2013 Movies
        -rwxr-xr-x  1 root root    296 Oct 27 02:20 .apdisk
        -rwxr-xr-x  1 root root   4096 Oct 27 02:20 ._.apdisk
        drwxr-xr-x 34 root root      0 Dec 23 13:46 Documents
        -rwxr-xr-x  1 root root   4096 Nov 29  2012 ._Documents
        -rwxr-xr-x  1 root root  15364 Nov 14 03:58 .DS_Store
        drwxr-xr-x 15 root root      0 Nov 13 07:28 Videos
        drwxr-xr-x  3 root root      0 Dec 14  2012 .TemporaryItems
        -rwxr-xr-x  1 root root   4096 Dec 14  2012 ._.TemporaryItems
        -rwxr-xr-x  1 root root 244012 Dec 31 16:06 Test.doc
        If I'm reading this right, it states that I have rw control over the /mnt/Shares/VIDEO folder, but none of the contents. So did I need to recursively chown that folder? Or have I messed up somewhere up the chain and this should not even be necessary? Aaargh.
        Last edited by mbwd1; Jan 07, 2014, 12:44 AM.

        Comment


          #19
          The files that existed within the folder won't change ownership automatically. Are you saying that on the other machine, the files show you own them but after mounting remotely they don't?

          Please Read Me

          Comment


            #20
            Thanks again. The files are on a USB stick attached to a router, so I only access them through computers on my network. The USB acts like a personal cloud in my house, so anyone can access the files on any computer. My other two computers are Macs -- and they can access the files as rw by mounting via Samba.

            So, am I correct to infer from your response that I need to change the ownership of /mnt/Shares/VIDEO and all files residing on each share (i.e., change the ownership recursively) to "mbwd1" from my Kubuntu computer? Does that have any impact on the ownership of the share VIDEO's files from other computers? That is, does this ownership change start and stop and Linux's mount?

            Comment


              #21
              I'm making a couple of assumptions, but assuming the USB stick is FAT32 or NTFS - it doesn't support ownership or permissions. How are you mounting the stick? What's the fstab line or other method you're using?

              If you mount it with fiesystem type cifs and use the "guest" option, you should have full access;

              mount -t cifs -o guest //server/share /path_to/mount

              or for fstab;

              //server/share /path_to_mount cifs defaults,guest 0 0

              Please Read Me

              Comment


                #22
                Your assumption of FAT32 is true for my two USB shares, both of which are plugged in to a router (I am also trying to access a Mac computer -- but first I'm trying to figure out these USBs). I am mounting them with fstab. I used the following:

                Code:
                //10.0.1.2/VIDEO /mnt/VIDEO cifs credentials=/home/.smbcredentials auto users,noatime,umask=0 0 0
                Code:
                //10.0.1.2/VIDEO /mnt/VIDEO cifs credentials=/home/.smbcredentials user,uid=1000,gid=100,dmask=027,fmask=137 0 0
                and after your suggestion:

                Code:
                //10.0.1.2/VIDEO /mnt/Shares/VIDEO cifs credentials=/home/.smbcredentials defaults,guest 0 0
                They all work in terms of mounting. And I can read any file. But I cannot write any file. Everything comes up as owned by root.

                Any other ideas where I could be going wrong?

                Comment


                  #23
                  Wrapping this back to a few prior comments, I tried to simply "browse" to the shared drives using Dolphin>Network>Samba Shares>Workgroup. And . . . . I do get rw access that way (i.e., without mounting -- I commented those lines in fstab). But then I have the problem with VLC not being able to play movies (and also MS Office through Wine/Play on Linux doesn't work at all).

                  So it looks like there are two issues:

                  1) how to automount a share so that it can get rw access;

                  and

                  2) if you browse to a share (instead of automount), how can you get VLC and Office to read the files.
                  Last edited by mbwd1; Jan 07, 2014, 10:47 PM.

                  Comment


                    #24
                    FYI: Using the same computer, I booted into a persistent live Ubuntu USB disk. Using that, I had no problem (a) browsing to the shares using the file manager without specifically mounting (no fstab edits) and (b) opening VLC files and having rw access.

                    Comment


                      #25
                      Anyone have any other suggestions? I have exhausted what I can do.

                      I did try to mount the share to my /home directory instead of /mnt. The result was the same: it was owned by root, not the user.

                      I used these commands, to no avail:

                      Code:
                      //10.0.1.8/VIDEO /home/mbwd1/Shares/VIDEO cifs credentials=/home/mbwd1/.smbcredentials auto rw,guest 0 0
                      Anyone able to help out on this?

                      Comment


                        #26
                        Ok, so I gave up. I must have messed up some file (other than /etc/fstab), but I can't get it to mount my shares and give me rw access. I've tried every combination of options at the end f the /etc/fstab mount I could find via searching. Nothing.

                        In the event anyone else has this problem in the future, I "resolved" it by installing the application smb4k. Smb4k can browse my entire network and uncovers all the shares. It can them mount them, and allows you to set the location for the mount. Most importantly for my purposes, it allows me to mount the shares a user rw, so I can delete/change files -- and also so I can view movies via VLC and open Word/Excel files.

                        Although I have not yet been able to instal the latest version (the repository version is about 3 iterations old, you need to compile the latest version), I understand that it allow for automatic mounting of "bookmarked" shares. That will entirely solve my problem.

                        Thanks to the posters above for their help.

                        Comment


                          #27
                          Final post -- for any other newbies out there -- just to round this out:

                          1) smb4k
                          smb4k works great to mount on demand, but I could not get it to automount on startup (though you can try these instructions)

                          2) FSTAB
                          For one of my shares, I just could not get fstab to work. It would mount, but would not give me read-write permissions. So I could not use it as my solution. Now, you should know that fstab is the preferred method to mount shares on startup. That said, it simply would not work for one of my shares. Also, the typical string that folks post did not work for me -- a few of the statements needed to be reorganized. Here is what did work for one of my shares:

                          Code:
                          //10.0.1.8/VIDEO /mnt/Shares/VIDEO cifs rw,guest,uid=1000,gid=1000,credentials=/mnt/Shares/.smbcredentials 0 0
                          For some reason, putting the credentials at the end, and in the root directory rather than home made this work. No idea why mine differed from the norm, but I discovered it from this LinuxMint post.

                          3) RC.LOCAL
                          Let me emphasize that this is NOT the right way to do this. FSTAB is the correct method. But I am posting this because this is the only way that worked for me, and it may help someone down the road. If I understand correctly, RC.LOCAL is loaded at boot, before a user login. As such, you don't need to enter sudo credentials. However, you do need to enter the share credentials. That can be done, as below, using a credentials file.

                          Code:
                          kdesudo gedit /etc/rc.local
                          Add this code at the end of the "rc.local" file, but before the text "exit 0"

                          Code:
                          sleep 45s
                          mount -t cifs -o credentials=/mnt/Shares/.smbcredentials,rw,hard,nosetuids,noperm,sec=ntlm //10.0.1.8/VIDEO /mnt/Shares/VIDEO
                          The "sleep 45s is necessary if you are using a wireless connection, to give the system time to load your wireless connection. You can change the time to what works for you. Again, only if you need to go this route. Becuase it is wrong . . . very wrong.
                          Last edited by mbwd1; Jan 12, 2014, 09:31 PM.

                          Comment

                          Working...
                          X