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

Thread: Inherited Folder's access permissions

  1. #1
    Join Date
    May 2013
    Location
    Syria
    Beans
    117
    Distro
    Ubuntu Gnome 13.10 Saucy Salamander

    Question Inherited Folder's access permissions

    I created "First" folder and edited its permissions to rwx as shown below:
    snapshot1.png

    Then I created sub-folder "Second" but it didn't inherit the parent folder permissions as shown below:
    snapshot2.png

    How can I activate folder's access permissions inheritance?
    Last edited by mbnoimi; June 10th, 2013 at 02:44 AM.

  2. #2
    dino99's Avatar
    dino99 is offline Ubuntu addict and loving it
    Join Date
    Jun 2006
    Location
    Nux Jam
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Inhited Folder's access permissions

    use chown :

    sudo chown youruser:youruser /path/to/folder

    https://help.ubuntu.com/community/FilePermissions

  3. #3
    Join Date
    Dec 2009
    Beans
    5,357

    Re: Inhited Folder's access permissions

    Linux doesn't have file permissions inheritance - at least not in the traditional way and at least not in the way you want it to be.

    But before you get too far with any non-traditional way you need to ask yourself why it's necessary for you to do this. What you have right now is this:

    /First ~ owner = mbnoimi , permissions = 700
    Only mbnoimi will gain access to that directory

    /First/Second ~ owner = mbnoimi, permissions = 775

    A given directory can only be accessed through the path to that directory so the only user that can access /First/Second is mbnoimi even if permissions on Second were 777 since /First won't let anyone else through.

  4. #4
    Join Date
    May 2013
    Location
    Syria
    Beans
    117
    Distro
    Ubuntu Gnome 13.10 Saucy Salamander

    Re: Inhited Folder's access permissions

    Quote Originally Posted by dino99 View Post
    use chown :

    sudo chown youruser:youruser /path/to/folder

    https://help.ubuntu.com/community/FilePermissions
    I don't want apply permissions manually whenever I created a new folder or file

  5. #5
    Join Date
    May 2013
    Location
    Syria
    Beans
    117
    Distro
    Ubuntu Gnome 13.10 Saucy Salamander

    Re: Inhited Folder's access permissions

    Quote Originally Posted by Morbius1 View Post
    Linux doesn't have file permissions inheritance - at least not in the traditional way and at least not in the way you want it to be.

    But before you get too far with any non-traditional way you need to ask yourself why it's necessary for you to do this. What you have right now is this:

    /First ~ owner = mbnoimi , permissions = 700
    Only mbnoimi will gain access to that directory

    /First/Second ~ owner = mbnoimi, permissions = 775

    A given directory can only be accessed through the path to that directory so the only user that can access /First/Second is mbnoimi even if permissions on Second were 777 since /First won't let anyone else through.
    Hmm you want to whole story behind my question

    I'm sharing my files over the network through SAMBA so whenever I created a sub-folder in the main shared folder the users can't see it because I've to change the permissions manually as the main folder's permissions. Same problem happen when network users add a new folder to my shared folder, I can't access it until I modify the permissions manually.

    PS
    I know this must be SAMBA's quesiuon but I face same issue with FTP shared folders too.

  6. #6
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Inhited Folder's access permissions

    Quote Originally Posted by mbnoimi View Post
    Hmm you want to whole story behind my question

    I'm sharing my files over the network through SAMBA so whenever I created a sub-folder in the main shared folder the users can't see it because I've to change the permissions manually as the main folder's permissions. Same problem happen when network users add a new folder to my shared folder, I can't access it until I modify the permissions manually.

    PS
    I know this must be SAMBA's quesiuon but I face same issue with FTP shared folders too.
    You can set a folders inheritance with the SUID and SGID bits. You set the default permissions with UMASK.
    -BAB1

  7. #7
    Join Date
    May 2013
    Location
    Syria
    Beans
    117
    Distro
    Ubuntu Gnome 13.10 Saucy Salamander

    Re: Inhited Folder's access permissions

    Quote Originally Posted by bab1 View Post
    You can set a folders inheritance with the SUID and SGID bits. You set the default permissions with UMASK.
    How can I do it?

    I tried to apply it for the main folder as following:
    snapshot3.png

    but the default permissions of sub-folders (created after applying the new permissions for main folder) is:
    snapshot4.png

  8. #8
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Inhited Folder's access permissions

    Permissions are not inheritance ownership.

    Tip: don't set the UID on these folders. The user is not important if all the users are in the same group. Just use SGID and put all the users in the group users . Then create a sub folder and see if the group is still users. If so we can set the permissions in the next step.

    Where in the file system tree are you creating this Samba share (/srv or /data or ...)?
    -BAB1

  9. #9
    Join Date
    Dec 2009
    Beans
    5,357

    Re: Inhited Folder's access permissions

    I'm sharing my files over the network through SAMBA so whenever I created a sub-folder in the main shared folder the users can't see it because I've to change the permissions manually as the main folder's permissions. Same problem happen when network users add a new folder to my shared folder, I can't access it until I modify the permissions manually.
    Since /First is set to owner = mbnoimi , permissions = 700 none of your samba clients can add to or even access the share unless they are coming in as mbnoimi but for the sake of argument one solution is to make everyone look like mbnoimi:

    Add the following line to /etc/samba/smb.conf:
    Code:
    force user = mbnoimi
    Where you put that line depends on how you created the samba share. If you want it to apply globally to all your shares then add it under the "workgroup = " line. If you want it to happen only to a specific share then add it to the share definition.

    Then restart samba:
    Code:
     sudo service smbd restart
    After the samba client gains access either as a guest or as a credentialed user he will be converted to mbnoimi. Everything they do they will do as mbnoimi - at least for your samba share.

    EDIT: This post:
    I'm sharing my files over the network through SAMBA so whenever I created a sub-folder in the main shared folder the users can't see it because I've to change the permissions manually as the main folder's permissions. Same problem happen when network users add a new folder to my shared folder, I can't access it until I modify the permissions manually.
    Is just the opposite of what you originally described as your requirement: You wanted all subfolders to have owner = mbnoimi and permissions of 700.
    Last edited by Morbius1; May 13th, 2013 at 05:21 PM.

  10. #10
    Join Date
    May 2013
    Location
    Syria
    Beans
    117
    Distro
    Ubuntu Gnome 13.10 Saucy Salamander

    Re: Inhited Folder's access permissions

    Quote Originally Posted by Morbius1 View Post
    Since /First is set to owner = mbnoimi , permissions = 700 none of your samba clients can add to or even access the share unless they are coming in as mbnoimi but for the sake of argument one solution is to make everyone look like mbnoimi:

    Add the following line to /etc/samba/smb.conf:
    Code:
    force user = mbnoimi
    Where you put that line depends on how you created the samba share. If you want it to apply globally to all your shares then add it under the "workgroup = " line. If you want it to happen only to a specific share then add it to the share definition.

    Then restart samba:
    Code:
     sudo service smbd restart
    After the samba client gains access either as a guest or as a credentialed user he will be converted to mbnoimi. Everything they do they will do as mbnoimi - at least for your samba share.
    Thanks, this works for SAMBA

    Is just the opposite of what you originally described as your requirement: You wanted all subfolders to have owner = mbnoimi and permissions of 700.
    I'm still missing it. I want to inherit the parent folder permissions and owner too... Any suggest?
    Last edited by mbnoimi; May 23rd, 2013 at 04:16 AM.

Page 1 of 2 12 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
  •