Announcement

Collapse
No announcement yet.

Automount SMB shares on NAS drive. FSTAB wipes ownership and permisions.

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

    Automount SMB shares on NAS drive. FSTAB wipes ownership and permisions.

    Hi

    I have a frustrating problem with SMB shares and Kubuntu 7.04 Feisty Fawn.

    I don't mind editing conf files and am familiar with permissions, so not totally new to Kubuntu but this is baffling me. I tend only to know what I have had to read up on, usually thanks to related problems.

    I have network attached storage on 10.0.0.x (x=is static number for the IP). Two shares for it:
    smb://10.0.0.x/HOUSEHOLD
    No user name and password for above.

    smb://10.0.0.x/DATA
    User=letssayme
    Password=letmein

    (no not really those login values but good for the example)

    For the sake of this post lets day my system login name is feisty.

    I want to mount these at startup as:
    /media/smbhousehold
    /media/smbdata

    Here is what I have tried and where I am stuck.
    First what is installed? I searched for 'smb' with an installed filter in Adept Manager.
    Code:
    libsmbclient
    smbclient
    smbfs
    xsmbrowser
    Then I created the directories in /media/ and created a file to store the login details and allowed root to read it only.
    Code:
    # cd /media
    # sudo mkdir smbdata
    # sudo mkdir smbhousehold
    # sudo touch .smbdatapasswd
    # sudo echo username=letssayme > .smbdatapasswd
    # sudo echo password=letmein >> .smbdatapasswd
    # sudo chmod 600 .smbdatapassword
    So now we have:
    Code:
    # ls -la /media/
    drwxr-xr-x 2 root     root      4096 2007-05-21 10:35 smbdata
    -rw------- 2 root     root      34 2007-05-21 10:35 .smbdatapasswd
    drwxr-xr-x 2 root     root      4096 2007-05-21 10:35 smbhousehold
    Obviously there is more contained in /media/ but that is all thats needed for this example.

    So to check it works:
    Code:
    sudo smbmount //10.0.0.x/DATA /media/smbdata -o username=letssayme,password=letmein,uid=1000,mask=000
    Wonderful, up comes the icon in Storage media folder, desktop. I can use it, have full read/write access. Bril.

    So now off to fstab
    Code:
    # sudo pico -w /etc/fstab
    Added these lines:
    Code:
    //10.0.0.x/HOUSEHOLD /media/smbhousehold smbfs auto,uid=1000,umask=000,rw,users 0 0
    //10.0.0.x/DATA /media/smbdata smbfs auto,credentials=/media/.smbdatapasswd,rw,users 0 0
    Next a full restart the of the system.

    Now the problem.
    On system startup there is a delay after logging in. The background doesn't show and after 30 seconds or so the desktop loads as normal. Going to Storage Media folder and it hangs for 30 seconds whilst the message on the status bar says 'Stalled'.

    So I go into terminal to take a look at the /media folder. When I ls -la it it takes another 30 seconds or so but gives me:
    Code:
    ls -la /media/
    ?--------- ? ?       ?         ?        ? smbdata
    -rw------- 1 root     root       34 2007-05-19 14:18 .smbdatapasswd
    ?--------- ? ?       ?         ?        ? smbhousehold
    Oo thats not good.

    So where am I going wrong?

    What have I tried already?
    Ok well I can get the folders back by using the following combination but the smbumount can take a long time before completing:
    Code:
    # cd /media
    # sudo smbumount /media/smbdata
    # sudo smbumount /media/smbhousehold
    # sudo chmod 755 smbdata
    # sudo chmod 755 smbhousehold
    # sudo chown root:root smbdata
    # sudo chown root:root smbhousehold
    Once back with me, the test mount command (above in post) works without problem.
    So does:
    Code:
    # sudo mount -a
    But when the system is restarted, it doesn't. Can Kubuntu only handle local drives in fstab?

    I have also tried different ownerships of the directories including:
    root:feisty, feisty:root and once feisty:feisty
    I think I tried 777 as permissions to no avail too.

    I also tried:
    Code:
    //10.0.0.x/DATA /media/smbdata smbfs auto,credentials=/media/.smbdatapasswd,rw,users 0 0
    as the line in fstab. All to no avail.

    If I had to guess it would seem that Kubuntu tries to mount the entries in fstab before it has the necessary network support loaded. But thats only a newbie guess.

    Can anyone help with the above problems? Can they please let me know if I've done something wrong and how to correct it.

    Perhaps the best way is a startup script instead, to manually mount the shares?
    If so how do I do one? Can anyone give me step by step. I don't even know how to turn a text file into a .sh script. So step by step is needed.

    I have read around and, no, the 'msdfs proxy' bug in smb.conf is not related to this problem. I want to access shares not share anything on my box. The 'msdfs proxy' line the bug mentions is not present in my smb.conf.

    Well, I'm sure I'm not the only one. Here's hoping someone can help. Thanks in advance.

    Regards,
    Matt

    #2
    Re: Automount SMB shares on NAS drive. FSTAB wipes ownership and permisions.

    I know nothing about any of this, it took me ages to get samba and a NTFS share working as auto mount in the fstab file. Now I have new machine I cant even get the file sharing working properly again, let alone worry about auto mount....
    BUT
    when I had a problem with the NTFS share not auto mounting, there was two changes I had to make.
    One detailed here:
    http://www.penguin.ch/dokuwiki/doku....tab#a_bad_joke

    And the second was getting rid of smbfs in the fstab file and replacing with cifs.

    No idea if that will help you, but it worked here for an auto mount of an ntfs folder

    Here is the thread that I staaaaaarted that helped me out:
    http://kubuntuforums.net/forums/inde...opic=3082676.0

    Comment


      #3
      Re: Automount SMB shares on NAS drive. FSTAB wipes ownership and permisions.

      Hi Neil

      Thank you. I think the first link:
      http://www.penguin.ch/dokuwiki/doku....tab#a_bad_joke
      is probably the cause. but I'd rather not mess around with the load order of the scripts.

      I changed the filesystem type to cifs and tried. They didn't error but then accessed the shares displayed an empty folder. So they didn't succeed.

      What I would find interesting is:
      1> The related lines in your fstab file to the shares.
      2> The CIFS installed items.

      My reasoning is:
      1> Perhaps I have messed up the mount parameters somehow.

      2> Perhaps you have something installed I don't. Would you mind going to the Adept Package manager. Searching with cifs and filter by installed items. If you list something I don't have installed that may be the reason.

      Once I've checked that lot out I will abandon this approach and try to figure out how to make the two commands into a startup script that can be run as root.

      Thanks.

      Regards,
      Matt

      Comment


        #4
        Re: Automount SMB shares on NAS drive. FSTAB wipes ownership and permisions.

        '/Su/Pictures /home/pics' smbfs user,auto,rw,uid=1000,gid=1000,umask=000 0 0

        Is the fstab line, but with cifs instead of smbfs

        Cant help with the other bits today, as that machine is unplugged and in the car ready for the dump, but I can pull it out tomorrow and hook it back up again. Spent a few weeks getting to grips with Kubuntu on it ( an old sub 1Ghz PIII) finally got it all working, and then have acquired a P41.9 Gh machine with 1 gig of ram, so need to go through setting the bloody thing up again

        Comment


          #5
          Re: Automount SMB shares on NAS drive. FSTAB wipes ownership and permisions.

          Hi Neil

          Thanks. Don't fret about rescuing the machine from the dump. After a more careful reading of your links I arrived at the following conclusions.
          FSTAB is loaded in the wrong order on startup. Before, not after network support. Messing with this was more than I was prepared to do.www

          I'm going to write a HOWTO on how I accomplished the same result as an automount in fstab. Essentially I used the KDE autostart and edited sudoers file.

          Thanks for your help. I'll put the link on the end here once it is written.

          Regards,
          Matt

          Comment


            #6
            Re: Automount SMB shares on NAS drive. FSTAB wipes ownership and permisions.

            For any others interested. I wrote a howto about my successful conclusions here:

            http://kubuntuforums.net/forums/inde...opic=3083442.0

            Hope it helps some at least.

            Regards,
            Matt

            Comment

            Working...
            X