Page 1 of 4 123 ... LastLast
Results 1 to 10 of 36

Thread: Samba configuration help

  1. #1
    Join Date
    Oct 2021
    Beans
    18

    Question Samba configuration help

    Perhaps this is something easy but I cant seem to figure it out. I'm trying to make a single share service folder that when the user enters that folder(My Folder) it automatically takes them into a folder named after the users login name and to have it set to use the specific parameters set for that folder. So here is an example of what I have written to smb.conf and what I am trying to do.

    [Mario]
    comment = Mario's Folder
    path = /Users/U% <<<this sends the user 'Mario' into a folder named /Mario, or basically their username.
    browseable - no
    valid users = Mario, Toad, Yoshi

    [Luigi]
    comment = Luigi's Folder
    path = /Users/%U <<<this sends the user 'Luigi' into a folder named /Luigi, or basically their username.
    browseable = no
    valid users = Luigi, Bowser, Peach


    [My Folder]
    comment = %U home directory
    browseable = yes
    copy = U% <<<theoretically this should copy the same parameters from the service named after the user [Mario] or [Luigi] but it doesnt work.


    I'm trying to make it so there is only one network folder called 'My Folder' and entering it takes the user directly to their own mostly private folder. Basically 'path' is set to redirect the user that is login in to a folder named after their username. the %U replaces itself with the name of the user login in. This works perfectly for 'path'. So for example if I login with Mario it will replace /Users/%U to /Users/Mario and send me into that folder. If where I to login with Luigi then it would take me to /Users/Luigi. So the %U as a variable works.

    The problem I am having is using %U variable for the 'copy' parameter. It doesn't seem to like %U variable. The 'copy' command lets you copy parameters from another service such as [mario]. Without the 'copy' command then i dont inherit the correct parameters I need from [mario] and end up not having any writing permissions when entering the folder through 'My Folder'. If I manually add in (copy = Mario) to the [My Folder] service, then it will inherit all the parameters from [Mario] and work exactly like I need it to. But then if Luigi logs in it will get wrong set of parameters, the [Mario] parameters which are different from [Luigi]. So the problem is that I cannot get 'copy' to use %U variable. How do i fix this?

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

    Re: Samba configuration help

    Why not use the [homes] special stanza to provide access by username for each user's HOME directory?


    Code:
    [homes]
      comment = Home Directories
      hosts allow = 127.0.0.1 172.22.22.0/24  
      hosts deny = 0.0.0.0/0
      browseable = yes
      guest ok = no
      writable = yes
      create mask = 0644
      directory mask = 0755
      valid users = %S

  3. #3
    Join Date
    Oct 2021
    Beans
    18

    Re: Samba configuration help

    Hmm... Ok thanks I"ll try it later today and see if I can get it to work and report back.

  4. #4
    Join Date
    Mar 2007
    Beans
    1,155

    Re: Samba configuration help

    If you want to specify a different folder you can put that in the share with
    Code:
    path = /some/directory/%U
    It s usually and by default
    Code:
    path=/home/%U
    Actually there are a number pre-defined of variables you can use.
    I actually have my [homes] point to a different server from my login server.

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

    Re: Samba configuration help

    Quote Originally Posted by fjl05 View Post
    Hmm... Ok thanks I"ll try it later today and see if I can get it to work and report back.
    I almost always specify these settings for each share stanza:
    Code:
      browseable = yes
      guest ok = no
      writable = yes
      create mask = 0644
      directory mask = 0755
    I might make the masks a little more restrictive, 640 or 750, but I always want to control the owner, group and other permissions.

    However, these days we only use samba to share HOME directories to the users on the system that have no other choice. Most users have Linux workstations and use NFS to access the storage on our LAN. Samba/CIFS is for Windows-only. NFS provides native permissions control and with NFSv4.x, there are some great performance tuning options to make it much faster.

  6. #6
    Join Date
    Oct 2021
    Beans
    18

    Re: Samba configuration help

    I've been having problems with the 'create mask' parameter like 'create mask = 755' does not come out as 755. I was reading up on it and mentions something about security or something that honestly goes above my head. But then I also learned of the 'force create mode' which does in fact work. But what exactly is the point of having two of these and using one that doesn't really do what its supposed to and what does it have to do with security? should I not be using 'force create mode'?

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

    Re: Samba configuration help

    Quote Originally Posted by fjl05 View Post
    I've been having problems with the 'create mask' parameter like 'create mask = 755' does not come out as 755. I was reading up on it and mentions something about security or something that honestly goes above my head. But then I also learned of the 'force create mode' which does in fact work. But what exactly is the point of having two of these and using one that doesn't really do what its supposed to and what does it have to do with security? should I not be using 'force create mode'?
    Try
    Code:
    create mask = 0755
    While chmod works with only 3 or 4 of the 4 octal values, I think Samba requires all 4. Doesn't my example show 4 octal values? It should if it doesn't.
    Last edited by TheFu; October 22nd, 2021 at 05:56 AM.

  8. #8
    Join Date
    Dec 2009
    Beans
    6,576

    Re: Samba configuration help

    I've been having problems with the 'create mask' parameter like 'create mask = 755' does not come out as 755.
    May I ask what resulting permissions you do get?

    And may I also ask why you want new files to be executable?

    As a side note: I changed my create mask value on your other question ( https://ubuntuforums.org/showthread.php?t=2468194 ) but if there is an issue here there might be an issue there.

  9. #9
    Join Date
    Oct 2021
    Beans
    18

    Re: Samba configuration help

    Quote Originally Posted by Morbius1 View Post
    May I ask what resulting permissions you do get?

    And may I also ask why you want new files to be executable?

    As a side note: I changed my create mask value on your other question ( https://ubuntuforums.org/showthread.php?t=2468194 ) but if there is an issue here there might be an issue there.
    I end up getting 744 as the permissions. And the reason I want them as executable is because it was part of my test try from the other thread to get the results of owners adding things and no one being able to delete things but the owners. But it isn't just so much about that. Its about things not working how they should. I tell it to do something and it just doesnt want to. That just further complicates things that are already complicated. Much like the first problem I mentioned when starting this thread, which I still need to test try actually. Basically it just frustrates me when things dont work like they should.

    1+1 should = 2 but instead equals 3.1415926535897932384626433832795. Like, just why?

  10. #10
    Join Date
    Oct 2021
    Beans
    18

    Re: Samba configuration help

    Quote Originally Posted by TheFu View Post
    Try
    Code:
    create mask = 0755
    While chmod works with only 3 or 4 of the 4 octal values, I think Samba requires all 4. Doesn't my example show 4 octal values? It should if it doesn't.
    I tried create mask = 0755 I still got an output of 744 permissions -rwxr--r--.
    Only force create mode seems to do the trick. I still dont understand why 'create mask' is limited and doesnt allow me to do exactly what I need. Whats the point of that? I tried reading up on it, but the jargon goes over my head.

Page 1 of 4 123 ... 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
  •