Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Sharing a folder to everyone

  1. #1
    Join Date
    Jul 2006
    Beans
    486

    Sharing a folder to everyone

    Hi Folks
    I just installed a new HDD Raid in my Ubuntu 12.04 box, and that went fine. But I am trying to share this drive, which is mounted at /mnt/data, to my entire network, and it is giving me errors when trying to write to the directory.

    I followed the steps here:
    https://help.ubuntu.com/12.04/server...ileserver.html

    and my folder is setup exactly as above, but I can't write it to. I can see the folder from other windows machines in my network, and I can read the contents, but I can't create a new folder, or copy files to it.

    Basically I want to share this folder openly to anyone on my network.

    Thanks.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Sharing a folder to everyone

    Which client OSes need to read it?

    What sort of data does it have?

    Any programs?

  3. #3
    Join Date
    Jul 2006
    Beans
    486

    Re: Sharing a folder to everyone

    Quote Originally Posted by TheFu View Post
    Which client OSes need to read it?

    What sort of data does it have?

    Any programs?
    I have other Ubuntu boxes, and a couple of Windows 7 boxes.

    Mostly videos, but some documents too.

    No programs.

  4. #4
    Join Date
    Dec 2009
    Beans
    6,772

    Re: Sharing a folder to everyone

    Make the following change:
    [share]
    comment = Ubuntu File Server Share
    path = /srv/samba/share
    browsable = yes
    guest ok = yes
    read only = no
    force user = nobody
    create mask = 0755
    Restart samba:
    Code:
    sudo service smbd restart
    Wait a few minutes for the network to settle down then see if you can write to the share.

    If that doesn't fix it post the output of the following command:
    Code:
    ls -dl /srv/samba/share

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Sharing a folder to everyone

    Quote Originally Posted by kc5hwb View Post
    I have other Ubuntu boxes, and a couple of Windows 7 boxes.
    Mostly videos, but some documents too.
    No programs.
    Ok, perfect for samba. Those instructions are to share files read-only. It seems to be working.
    For read-write access there are 2 additional things.
    * smbpasswd
    * correct file/group permissions on the Linux side.
    So, every userid that you want to have with read-write access will need to be in the same Linux group (/etc/groups) AND each userid will need to have a passwd set using smbpasswd.

    For documents, it is often best to place those under each user's HOME and use the special [homes] section.
    For media, I prefer to have 1 read-write account and all the others are read-only. This way other members of the household don't accidentally delete everything. It is also easier to setup since you don't need to setup groups, since "other" permissions will be sufficient.

    Code:
    $ man smbpasswd 
    $ man smb.conf
    $ man groups
    will explain more - perhaps everything.

    Of course, your specific needs could be more complex than my current needs. If you are stuck, post these:
    * ls -al /path/to/dir
    * relevant parts of /etc/samba/smb.conf
    * explain which users and groups you want AND which sort of access they should have.

    Testing from Linux will tell us if it is a Win7 specific issue or not. smbtree is a great tool for that.

    BTW, I do not have **any** experience with Samba4, but plan to in the next year.

  6. #6
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Sharing a folder to everyone

    So the
    force user = nobody
    part is just scary to me. Anyone on the network will have read-write access to the share without any real audit abilities.
    I'd prefer to use chmod g+s to force group perms than to have everyone's access through a single account. Maybe this is overkill for a home network.

  7. #7
    Join Date
    Dec 2009
    Beans
    6,772

    Re: Sharing a folder to everyone

    Quote Originally Posted by TheFu View Post
    Ok, perfect for samba. Those instructions are to share files read-only. It seems to be working.
    Just the opposite is true. It's designed to allow everyone on the network to write to the share.

    The problem is it will only work if you never create a samba user ( smbpasswd ) or have one created for you ( libpam-smbpass ) because the permissions on the target folder are set to nobody:nogroup.

    It's a bad HowTo and one that couldn't possibly have passed peer review. "force user = nobody" fixes it for this problem and in the future when the user wants to create a private share on another folder.

    EDIT: There is another alternative of course and that to set the folder to 777:
    Code:
    sudo chmod 777 /srv/samba/share
    Last edited by Morbius1; February 28th, 2013 at 10:41 PM.

  8. #8
    Join Date
    Jul 2006
    Beans
    486

    Re: Sharing a folder to everyone

    Quote Originally Posted by TheFu View Post
    So the
    force user = nobody
    part is just scary to me. Anyone on the network will have read-write access to the share without any real audit abilities.
    I'd prefer to use chmod g+s to force group perms than to have everyone's access through a single account. Maybe this is overkill for a home network.
    Well to clarify, when I say "anyone on the network" I really mean any other machine that I myself am using on the network. My wife and I live alone, and she doesn't do much on the computer except browse Facebook, so really it is just me wanting access to this share from my other Ubuntu and Windows boxes.

    I have setup share in the past with using (smbpasswd ), and I should have written down how I did it, but unfortunately I didn't. I do remember using some command similar to CHMOD RWA+UGA or some-such, but I can't remember exactly what I did. Once I find the solution this time, I will make a note of it for future uses.

  9. #9
    Join Date
    Dec 2009
    Beans
    6,772

    Re: Sharing a folder to everyone

    Quote Originally Posted by kc5hwb View Post
    Well to clarify, when I say "anyone on the network" I really mean any other machine that I myself am using on the network. My wife and I live alone, and she doesn't do much on the computer except browse Facebook, so really it is just me wanting access to this share from my other Ubuntu and Windows boxes..
    Well, if this is just another box on the network and one you log into yourself then I would make the following changes:
    Change permissions from nobody:nogroup to you:
    Code:
    sudo chown kc5hwb /srv/samba/share
    Then change the share to this:
    [share]
    comment = Ubuntu File Server Share
    path = /srv/samba/share
    browsable = yes
    guest ok = yes
    read only = no
    force user = kc5hwb
    create mask = 0755
    If this isn't a true Server with a capital "S" then "force user = nobody" won't do you much good since when you are logged into the machine itself you won't be able to write to it locally as you are not "nobody"

  10. #10
    Join Date
    Jul 2006
    Beans
    486

    Re: Sharing a folder to everyone

    The force user = nobody worked for writing to the share from another machine. But you are correct, I can't write to it locally.

    Changing the ownership to my user account seemed to work too, but when I use my wife's Windows 7 machine, while logged in with her account, it also lets me write to it over the network. So it is working as I want, but I am not sure why it still lets me write from my wife's account after CHOWNing the folder to my account.

Page 1 of 2 12 LastLast

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
  •