Page 1 of 3 123 LastLast
Results 1 to 10 of 34

Thread: How can I give multiple users equal access/ownership to the same samba share?

Hybrid View

  1. #1
    Join Date
    Nov 2013
    Beans
    23

    Question How can I give multiple users equal access/ownership to the same samba share?

    I'm starting to pull my hair out (and I don't have much left unfortunately).

    My setup is the following. I have Ubuntu Server 12.04LTS running on a box in my office which has the following SMB share:

    [galactica]
    comment=galactica
    path=/mnt/galactica
    browsable=yes
    writeable=yes
    guest ok=yes
    read only=no
    create mask=0777
    follow symlinks=yes
    directory mask=0777
    I have a desktop machine in the family room that my wife and I use (each with separate accounts), which is currently running Ubuntu Client 13.10. I've configured the FSTAB to auto-mount the samba share automatically at boot:

    //192.168.1.118/galactica /media/galactica cifs guest,_netdev,iocharset=utf8,gid=1002,uid=1000 0 0
    The GID is a group that has both our user accounts in it (me + wife). The UID is my user account. All of this works just fine in my user account.

    When my wife is using the share drive, she is able to create directories with no issue, however the problem arises when she attempts to create files.

    When she copies or creates files in the share, the icons show up with a little lock in the lower right hand corner. When looking at the permissions for these files, it appears that my user owns the file and she has only read permissions (group and other have read permission as well).

    I've tried many, many different fstab configurations, but nothing seems to help. (including adding her UID, noperm, umask, dmask, fmask, etc.)

    Help me internet! You are my only hope.
    Last edited by nebhead772; December 18th, 2013 at 10:17 PM. Reason: Formatting.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    12,441
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: How can I give multiple users equal access/ownership to the same samba share?

    Whoa.... I skimmed your question. Why are you mounting a samba share on a Linux box? If that is the same Linux machine as holds the HDD, this is not what you want.

    Samba shares folders to Windows machines. The only reason to mount a CIFS share from Linux is if the files are hosted under Windows.

    The best way to share files between 2 Linux machines is with NFSv4. There is a client side and a server side. https://help.ubuntu.com/community/NFSv4Howto should help. With NFS, file owner, group, and other permissions are honored with just a few exceptions. It is easy to forget that files are actually located on a different physical machine. It is THAT good.

    While you can use samba to share files between two UNIX/Linux systems, I wouldn't for systems that are not portable or wifi connected. NFS is much nicer.

  3. #3
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,758
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: How can I give multiple users equal access/ownership to the same samba share?

    Hi nebhead772.
    Quote Originally Posted by TheFu View Post
    NFS is much nicer.
    +1

    ... and much easier I might add.

    You seem to have a good grasp of setting ownership and permissions for a collaborative project. Since samba would add an extra layer on top of the Linux permission and ownership logic you know and understand, I'd recommend going with NFS.

    You would need to:
    • Install one package.
    • Add one line to a file to export the directory.
    • Change slightly the mount on fstab so you use NFS instead of cifs, and
    • Match your ownership and permissions on the server and in the client.

    This would be a good start: Simple HOWTO: NFS Server/Client.

    Hope it helps. Let us know how it goes.
    Regards.

  4. #4
    Join Date
    Nov 2013
    Beans
    23

    Re: How can I give multiple users equal access/ownership to the same samba share?

    Papibe - Ok, things are going great. I read the guide that you pointed me to and it couldn't have been easier to setup. I had a little trouble with Ubuntu Desktop 13.10 not auto-mounting, but I found this thread here which fixed it for me.

    However, now when I create files or directories in the new shares, the permissions appear a bit wonky.

    Owner: nobody (Read & Write)
    Group: -2 (Read Only)

    This part of your directions above makes me think I am missing something here, since I didn't see anything specific about the below.

    Quote Originally Posted by papibe View Post

    • Match your ownership and permissions on the server and in the client.
    Can you elaborate?

    Thanks!
    Nebhead.

  5. #5
    Join Date
    Nov 2013
    Beans
    23

    Re: How can I give multiple users equal access/ownership to the same samba share?

    Quote Originally Posted by TheFu View Post
    Whoa.... I skimmed your question. Why are you mounting a samba share on a Linux box? If that is the same Linux machine as holds the HDD, this is not what you want.

    Samba shares folders to Windows machines. The only reason to mount a CIFS share from Linux is if the files are hosted under Windows.

    The best way to share files between 2 Linux machines is with NFSv4. There is a client side and a server side. https://help.ubuntu.com/community/NFSv4Howto should help. With NFS, file owner, group, and other permissions are honored with just a few exceptions. It is easy to forget that files are actually located on a different physical machine. It is THAT good.

    While you can use samba to share files between two UNIX/Linux systems, I wouldn't for systems that are not portable or wifi connected. NFS is much nicer.
    Yeah, I probably should have been more clear. I have several computers in the house including both Windows and Linux boxes. I have an Ubuntu 12.04LTS server which I use as a NAS drive for all our photos, videos, music, etc. I need to share these files to all the other machines in the house (windows and linux) and hence have the samba share setup to share to the network. The Windows machines have absolutely no issue accessing the share and have no permissions issues at all. However, I have an Ubuntu desktop machine (not the same machine as the server) with two user accounts (mine and wifes) which have trouble with permissions when I try to mount the same share.

    Now, if you are suggesting that I use NFS on my Ubuntu Server to share files with the Ubuntu Desktop machine, that's great. I can give that a shot. Will that co-exist with Samba on the server? Or will I have issues/conflicts? Will this help eliminate my permissions issues client side?

    Thanks for the response!

  6. #6
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How can I give multiple users equal access/ownership to the same samba share?

    Quote Originally Posted by nebhead772 View Post
    I have several computers in the house including both Windows and Linux boxes. I have an Ubuntu 12.04LTS server which I use as a NAS drive for all our photos, videos, music, etc. I need to share these files to all the other machines in the house (windows and linux) and hence have the samba share setup to share to the network. The Windows machines have absolutely no issue accessing the share and have no permissions issues at all. However, I have an Ubuntu desktop machine (not the same machine as the server) with two user accounts (mine and wifes) which have trouble with permissions when I try to mount the same share.

    Now, if you are suggesting that I use NFS on my Ubuntu Server to share files with the Ubuntu Desktop machine, that's great. I can give that a shot. Will that co-exist with Samba on the server? Or will I have issues/conflicts? Will this help eliminate my permissions issues client side?
    You can't use NFS if you have windows systems that need to share information. You problem is fairly easy to solve however. You actually have the first part already done ( the common group). To extend that thought you need to add inheritance of the group. See here (post #5) where I have described the process previously. Here is an easy guide to the use of Linux permissions (chmod)

    I want to point out that if you want to change the permissions you should follow this
    Code:
    chmod -R u=rwX,g=rwXs,o=rX <share_root>
    ...Using symbolic notation instead of octal allows you to use the X instead of the x. The capital X means preserve permissions only if the file the is already eXecutable, but do not make executable any others. Also the 's' in the 'g' section (red) resets the sgid for the inheritance again. Very handy when there is a lot of data.

    In summary. you set the inheritance and permissions at the top of the share and everything new will work. Then you reset the permissions on all the extant files and folders in the share tree.

    This will set the Linux file sever. We may have to tweak the Samba settings in smb.conf. That is really the final step.
    -BAB1

  7. #7
    Join Date
    Nov 2013
    Beans
    23

    Re: How can I give multiple users equal access/ownership to the same samba share?

    Quote Originally Posted by bab1 View Post
    You can't use NFS if you have windows systems that need to share information. You problem is fairly easy to solve however. You actually have the first part already done ( the common group). To extend that thought you need to add inheritance of the group. See here (post #5) where I have described the process previously. Here is an easy guide to the use of Linux permissions (chmod)

    I want to point out that if you want to change the permissions you should follow this
    Code:
    chmod -R u=rwX,g=rwXs,o=rX <share_root>
    ...Using symbolic notation instead of octal allows you to use the X instead of the x. The capital X means preserve permissions only if the file the is already eXecutable, but do not make executable any others. Also the 's' in the 'g' section (red) resets the sgid for the inheritance again. Very handy when there is a lot of data.

    In summary. you set the inheritance and permissions at the top of the share and everything new will work. Then you reset the permissions on all the extant files and folders in the share tree.

    This will set the Linux file sever. We may have to tweak the Samba settings in smb.conf. That is really the final step.
    Doh. Well, I'm sort of already far down the path of setting up NFS based on feedback from others. But, same concept right? Maybe you can help with the permissions that I'm seeing here as well. I'm still am having trouble with permissions after following your instructions.

    Now I'm not able to create directories or files at all inside the share. As an experiment, I manually set a directory on the share to chmod 777 and I'm able to create files and sub-directories, however again I'm not able to modify them afterwards (they're assigned to nobody/users) with the group permissions set at read only.

  8. #8
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How can I give multiple users equal access/ownership to the same samba share?

    Quote Originally Posted by nebhead772 View Post
    Doh. Well, I'm sort of already far down the path of setting up NFS based on feedback from others. But, same concept right? Maybe you can help with the permissions that I'm seeing here as well. I'm still am having trouble with permissions after following your instructions.

    Now I'm not able to create directories or files at all inside the share. As an experiment, I manually set a directory on the share to chmod 777 and I'm able to create files and sub-directories, however again I'm not able to modify them afterwards (they're assigned to nobody/users) with the group permissions set at read only.
    The first thing you should check is that the username is the same on all machines. The username: bill on a Windows machine will be be understood by Samba and that Samba user should have the same uid as the Ubuntu user named bill. As a matter of fact this needs to be true in NFS. The Linux user (bill) on one machine has to have the same uid on the second Linux machine (client and server).

    The Samba server will set the user to nobody:nogroup if it can't match the user to the Samba user database. This is what is happening right now. Others have devised workarounds to this problem, but I prefer to set the thing up correctly in the first place.

    I think you should start at the beginning. You do not need to reinstall Samba on either the client or server. We will have to reconfigure the server. All we need to do is edit the smb.conf file. From the server post the output of these commands
    Code:
    cat /etc/hosts
    
    hosname
    
    cat /etc/samba/smb.conf
    Again, from the server, post the output of
    Code:
    sudo pdbedit -L
    ...this show who is actually a Samba user.

    What are the user names you are using on the other machines (the clients)? Do they match the users on the Samba server? In this case if processes use the share, they would then be considered system users. Not humans but still users of the services.

    I'll reread your posting so I don't ask the same questions that you have already answered.

    You haven't gone so far that you can't recover.

    Edit after reading your later comments.

    Doh. Well, I'm sort of already far down the path of setting up NFS based on feedback from others. But, same concept right? Maybe you can help with the permissions that I'm seeing here as well. I'm still am having trouble with permissions after following your instructions.
    NFS will never work with Windows. I've tried this and it won't work.
    Now I'm not able to create directories or files at all inside the share. As an experiment, I manually set a directory on the share to chmod 777 and I'm able to create files and sub-directories, however again I'm not able to modify them afterwards (they're assigned to nobody/users) with the group permissions set at read only.
    This isn't correct at all. We don't need to dump any data, but we will end up doing what I recommended. Is this data backed up somewhere. Don't beat yourself up, it's complicated from a newbies perspective. Understand that permissions and ownership are easily changed. If you want I will explain everything step by step.
    Last edited by bab1; December 19th, 2013 at 09:24 AM.
    -BAB1

  9. #9
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How can I give multiple users equal access/ownership to the same samba share?

    Quote Originally Posted by TheFu View Post
    Whoa.... I skimmed your question. Why are you mounting a samba share on a Linux box? If that is the same Linux machine as holds the HDD, this is not what you want.

    Samba shares folders to Windows machines. The only reason to mount a CIFS share from Linux is if the files are hosted under Windows.
    This is not really true anymore. At this point in their development, both have very effective userland filesystem (FUSE) drivers. NFS and CIFS performance is is about the same. The difference is That CIFS (both Windows and Samba) is designed to be browsed via a GUI interface. NFS does not have that ability. My Linux users like that.
    -BAB1

  10. #10
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    12,441
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: How can I give multiple users equal access/ownership to the same samba share?

    Quote Originally Posted by bab1 View Post
    This is not really true anymore. At this point in their development, both have very effective userland filesystem (FUSE) drivers. NFS and CIFS performance is is about the same. The difference is That CIFS (both Windows and Samba) is designed to be browsed via a GUI interface. NFS does not have that ability. My Linux users like that.
    What!!!!!? I must be misreading this bab1. NFS shares happen on the system-to-system level and are accessed using any GUI just like local drives physically connected to the machine are. Plus using NFS skips the entire gvfs crap. End-users shouldn't need to know where storage is on the network, IMHO. It should just be "available" where ever they need it and it should act the same as local storage for permissions. CIFS doesn't do this, but NFS does.

    To me, the fact that remote shared disks do not appear on the normal file system is a huge flaw in the gvfs stuff. Why should I need to use any GUI? Sorta reminds me of MS-Windows "Libraries" ... they only work through Exploder, not from cmd.exe or powershell. Yuck.

    I must be misunderstanding your point, bab1, since I know how smart you are (extremely!). It is usually you pointing out my lack of understanding and clarity.

    NFS provides a nearly-complete file system implementation to other NFS clients that support it. The Linux NFS client does, easily.

    Back to the last question - Can NFS and samba "share" the same file storage? Yes. No issue. Linux file locking on the HOST will handle any contention issues. This has worked well since the mid-1990s.

    Anyway, I hope this is clear. Sometimes I am not as clear as I believe.

    Update: From my reading of the later posts, it seems that a 30 min Linux/Unix file permissions tutorial would be helpful to the OP. There is nothing magical about users, groups, owners and the file permissions on Linux, but it does take a little effort to get a good understanding.
    Last edited by TheFu; December 19th, 2013 at 05:45 PM. Reason: updates after reading later posts.

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •