I cant get samba to set proper permissions on created directories












15















I have a ubuntu server sharing some folders using samba. When a client creates a new folder or file, the permissions aren't set according to the settings in smb.conf.



My current settings for a specific share:



[share]
path = /mnt/share
browsable = yes
guest ok = no
writable = yes
read only = no
create mask = 0774
directory mask = 0774
write list = netuser


When a samba client (a windows 7 box) uses the 'netuser' account to create a file or directory, the permissions become



drwxr-sr-- 2 netuser sambashare      4096 2012-01-22 21:14 New folder
-rwxrw-r-- 1 netuser sambashare 0 2012-01-22 21:07 New Text Document.txt


The parent directory has the set group id flag, thus the sambashare group owner. The idea is that both samba users and server users belong to the sambashare group, and thus are to be able to edit, delete, and create files and directories. However, since created folders doesn't have the write flag for group set, server users cant create new files or folders in those folders without sudo.



i have tested adding and removing the directory mask, force directory mode, directory security mode, and the force directory security mode, but the behaviors still remains. Newly created files and folders doesn't get intended 774 permission, but rather 764 and 754 respectively.



What am I missing? Why doesn't samba set the correct permissions?










share|improve this question



























    15















    I have a ubuntu server sharing some folders using samba. When a client creates a new folder or file, the permissions aren't set according to the settings in smb.conf.



    My current settings for a specific share:



    [share]
    path = /mnt/share
    browsable = yes
    guest ok = no
    writable = yes
    read only = no
    create mask = 0774
    directory mask = 0774
    write list = netuser


    When a samba client (a windows 7 box) uses the 'netuser' account to create a file or directory, the permissions become



    drwxr-sr-- 2 netuser sambashare      4096 2012-01-22 21:14 New folder
    -rwxrw-r-- 1 netuser sambashare 0 2012-01-22 21:07 New Text Document.txt


    The parent directory has the set group id flag, thus the sambashare group owner. The idea is that both samba users and server users belong to the sambashare group, and thus are to be able to edit, delete, and create files and directories. However, since created folders doesn't have the write flag for group set, server users cant create new files or folders in those folders without sudo.



    i have tested adding and removing the directory mask, force directory mode, directory security mode, and the force directory security mode, but the behaviors still remains. Newly created files and folders doesn't get intended 774 permission, but rather 764 and 754 respectively.



    What am I missing? Why doesn't samba set the correct permissions?










    share|improve this question

























      15












      15








      15


      11






      I have a ubuntu server sharing some folders using samba. When a client creates a new folder or file, the permissions aren't set according to the settings in smb.conf.



      My current settings for a specific share:



      [share]
      path = /mnt/share
      browsable = yes
      guest ok = no
      writable = yes
      read only = no
      create mask = 0774
      directory mask = 0774
      write list = netuser


      When a samba client (a windows 7 box) uses the 'netuser' account to create a file or directory, the permissions become



      drwxr-sr-- 2 netuser sambashare      4096 2012-01-22 21:14 New folder
      -rwxrw-r-- 1 netuser sambashare 0 2012-01-22 21:07 New Text Document.txt


      The parent directory has the set group id flag, thus the sambashare group owner. The idea is that both samba users and server users belong to the sambashare group, and thus are to be able to edit, delete, and create files and directories. However, since created folders doesn't have the write flag for group set, server users cant create new files or folders in those folders without sudo.



      i have tested adding and removing the directory mask, force directory mode, directory security mode, and the force directory security mode, but the behaviors still remains. Newly created files and folders doesn't get intended 774 permission, but rather 764 and 754 respectively.



      What am I missing? Why doesn't samba set the correct permissions?










      share|improve this question














      I have a ubuntu server sharing some folders using samba. When a client creates a new folder or file, the permissions aren't set according to the settings in smb.conf.



      My current settings for a specific share:



      [share]
      path = /mnt/share
      browsable = yes
      guest ok = no
      writable = yes
      read only = no
      create mask = 0774
      directory mask = 0774
      write list = netuser


      When a samba client (a windows 7 box) uses the 'netuser' account to create a file or directory, the permissions become



      drwxr-sr-- 2 netuser sambashare      4096 2012-01-22 21:14 New folder
      -rwxrw-r-- 1 netuser sambashare 0 2012-01-22 21:07 New Text Document.txt


      The parent directory has the set group id flag, thus the sambashare group owner. The idea is that both samba users and server users belong to the sambashare group, and thus are to be able to edit, delete, and create files and directories. However, since created folders doesn't have the write flag for group set, server users cant create new files or folders in those folders without sudo.



      i have tested adding and removing the directory mask, force directory mode, directory security mode, and the force directory security mode, but the behaviors still remains. Newly created files and folders doesn't get intended 774 permission, but rather 764 and 754 respectively.



      What am I missing? Why doesn't samba set the correct permissions?







      permissions samba file-sharing






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 22 '12 at 20:20









      ZazZaz

      5492616




      5492616






















          5 Answers
          5






          active

          oldest

          votes


















          18














          I think you need to use the following parameters:



          # I changes the permissions to rw-rw-r--
          # You should be able to change them to 775 if you need the files to
          # be executable
          create mask = 664
          force create mode = 664
          security mask = 664
          force security mode = 664

          # I set the SGID flag here as I thought this is what you wanted
          # You could change to 0775
          directory mask = 2775
          force directory mode = 2775
          directory security mask = 2775
          force directory security mode = 2775


          I was looking for a nice explanation of how these settings work, but could not find anything better then man smb.conf



          You will have to scroll down a bit for those options.



          Basically, in a nutshell, windows permissions are not the same as unix (linux) and it is a bit odd how samba maps permissions.






          share|improve this answer



















          • 1





            Yes, that seems to be roughly the same manpage as samba.org/samba/docs/man/manpages-3/smb.conf.5.html which I looked at, the problem is that it doesn't seem to matter what octal values I set, I still get the same permissions set on the created file or folder.

            – Zaz
            Jan 23 '12 at 11:14











          • Did you set all the options I gave you ? If so, please update your first post and at that point I would suggest you file a bug report.

            – Panther
            Jan 23 '12 at 16:10






          • 1





            It already said.. but on closer inspection and testing, adding the 2 to the directory masks did fix the problem. Many thanks. : D

            – Zaz
            Jan 23 '12 at 18:37











          • Fantastic, thank you for marking this as the accepted answer, it help others with a similar problem.

            – Panther
            Jan 23 '12 at 19:14











          • Samba configuration is overly complex and really hard to understand. For example what is the logical difference between force create and just create... makes no sense. Your hint is a life saver though - thank you!

            – Matthias Hryniszak
            Feb 27 '16 at 19:55



















          8














          After a lot of trial and error, this is the correct code to share samba dir using SGID and unix groups. If user connects anonymously he gets r/o, if he logs in and is a member of assigned group he gets r/w.



          I have group named 'admin' set as primary group to users with write privileges, everyone else gets read only rights.



          I force user to nobody, so different people working on same files don't interfere with each other.



          I set chmod 2755 on shared directory, so it inherits created directories with the same group 'admin'



          $ chmod -R 2755 /home/shares/test


          Checking if all is good:



          $ stat /home/shares/test
          Access: (2755/drwxr-sr-x) Uid: (65534/ nobody) Gid: ( 1001/ admin)


          Relevant part of /etc/samba/smb.conf:



          [test]
          comment = test
          path = /home/shares/test
          force user = nobody
          read only = No
          create mask = 0664
          force create mode = 0664
          directory mask = 02775
          force directory mode = 02775


          This post put me on right track, but testparm revealed 4 incorrect directives, so I'm sharing fixed config here. In samba, the less directives you specify the better it works.






          share|improve this answer































            5














            I had the same problem, but everything like mask directives did not work for me (Samba 4.3.11):



             create mask = 0664
            force create mode = 0664
            directory mask = 02775
            force directory mode = 02775


            The only option that worked was under the [global] or share section:



             inherit permissions = yes


            Just change all folder and file permissions to your need, so future folders and files will inherit the same permissions.






            share|improve this answer
























            • I am using Samba version 4.7.6-Ubuntu. And this is working for me too.

              – Andi S.
              Jul 20 '18 at 7:00



















            2














            There is a very similar problem when connecting from other Unix / Linux / OSX / MacOS devices: all of the settings are ignored unless you specify



            [global]

            unix extensions = no


            And connect with smb://<serverhost> instead of cifs://<serverhost>.






            share|improve this answer

































              0














               Here add this code to the sudo nano smb.conf
              and restart sudo service smbd restart and access from another local PC/computer using connect with smb://<serverhost> to create or edit files/folder html is folder name

              [html]
              comment = admin access
              path = /var/www/html
              browsable = yes
              guest ok = no
              writable = yes
              valid users = @admin
              create mask = 664
              force create mode = 664
              security mask = 664
              force security mode = 664
              directory mask = 2775
              force directory mode = 2775
              directory security mask = 2775
              force directory security mode = 2775




              share








              New contributor




              ghanshyam nakiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.





















                Your Answer








                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "89"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f97669%2fi-cant-get-samba-to-set-proper-permissions-on-created-directories%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                5 Answers
                5






                active

                oldest

                votes








                5 Answers
                5






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                18














                I think you need to use the following parameters:



                # I changes the permissions to rw-rw-r--
                # You should be able to change them to 775 if you need the files to
                # be executable
                create mask = 664
                force create mode = 664
                security mask = 664
                force security mode = 664

                # I set the SGID flag here as I thought this is what you wanted
                # You could change to 0775
                directory mask = 2775
                force directory mode = 2775
                directory security mask = 2775
                force directory security mode = 2775


                I was looking for a nice explanation of how these settings work, but could not find anything better then man smb.conf



                You will have to scroll down a bit for those options.



                Basically, in a nutshell, windows permissions are not the same as unix (linux) and it is a bit odd how samba maps permissions.






                share|improve this answer



















                • 1





                  Yes, that seems to be roughly the same manpage as samba.org/samba/docs/man/manpages-3/smb.conf.5.html which I looked at, the problem is that it doesn't seem to matter what octal values I set, I still get the same permissions set on the created file or folder.

                  – Zaz
                  Jan 23 '12 at 11:14











                • Did you set all the options I gave you ? If so, please update your first post and at that point I would suggest you file a bug report.

                  – Panther
                  Jan 23 '12 at 16:10






                • 1





                  It already said.. but on closer inspection and testing, adding the 2 to the directory masks did fix the problem. Many thanks. : D

                  – Zaz
                  Jan 23 '12 at 18:37











                • Fantastic, thank you for marking this as the accepted answer, it help others with a similar problem.

                  – Panther
                  Jan 23 '12 at 19:14











                • Samba configuration is overly complex and really hard to understand. For example what is the logical difference between force create and just create... makes no sense. Your hint is a life saver though - thank you!

                  – Matthias Hryniszak
                  Feb 27 '16 at 19:55
















                18














                I think you need to use the following parameters:



                # I changes the permissions to rw-rw-r--
                # You should be able to change them to 775 if you need the files to
                # be executable
                create mask = 664
                force create mode = 664
                security mask = 664
                force security mode = 664

                # I set the SGID flag here as I thought this is what you wanted
                # You could change to 0775
                directory mask = 2775
                force directory mode = 2775
                directory security mask = 2775
                force directory security mode = 2775


                I was looking for a nice explanation of how these settings work, but could not find anything better then man smb.conf



                You will have to scroll down a bit for those options.



                Basically, in a nutshell, windows permissions are not the same as unix (linux) and it is a bit odd how samba maps permissions.






                share|improve this answer



















                • 1





                  Yes, that seems to be roughly the same manpage as samba.org/samba/docs/man/manpages-3/smb.conf.5.html which I looked at, the problem is that it doesn't seem to matter what octal values I set, I still get the same permissions set on the created file or folder.

                  – Zaz
                  Jan 23 '12 at 11:14











                • Did you set all the options I gave you ? If so, please update your first post and at that point I would suggest you file a bug report.

                  – Panther
                  Jan 23 '12 at 16:10






                • 1





                  It already said.. but on closer inspection and testing, adding the 2 to the directory masks did fix the problem. Many thanks. : D

                  – Zaz
                  Jan 23 '12 at 18:37











                • Fantastic, thank you for marking this as the accepted answer, it help others with a similar problem.

                  – Panther
                  Jan 23 '12 at 19:14











                • Samba configuration is overly complex and really hard to understand. For example what is the logical difference between force create and just create... makes no sense. Your hint is a life saver though - thank you!

                  – Matthias Hryniszak
                  Feb 27 '16 at 19:55














                18












                18








                18







                I think you need to use the following parameters:



                # I changes the permissions to rw-rw-r--
                # You should be able to change them to 775 if you need the files to
                # be executable
                create mask = 664
                force create mode = 664
                security mask = 664
                force security mode = 664

                # I set the SGID flag here as I thought this is what you wanted
                # You could change to 0775
                directory mask = 2775
                force directory mode = 2775
                directory security mask = 2775
                force directory security mode = 2775


                I was looking for a nice explanation of how these settings work, but could not find anything better then man smb.conf



                You will have to scroll down a bit for those options.



                Basically, in a nutshell, windows permissions are not the same as unix (linux) and it is a bit odd how samba maps permissions.






                share|improve this answer













                I think you need to use the following parameters:



                # I changes the permissions to rw-rw-r--
                # You should be able to change them to 775 if you need the files to
                # be executable
                create mask = 664
                force create mode = 664
                security mask = 664
                force security mode = 664

                # I set the SGID flag here as I thought this is what you wanted
                # You could change to 0775
                directory mask = 2775
                force directory mode = 2775
                directory security mask = 2775
                force directory security mode = 2775


                I was looking for a nice explanation of how these settings work, but could not find anything better then man smb.conf



                You will have to scroll down a bit for those options.



                Basically, in a nutshell, windows permissions are not the same as unix (linux) and it is a bit odd how samba maps permissions.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 23 '12 at 6:04









                PantherPanther

                80k14159259




                80k14159259








                • 1





                  Yes, that seems to be roughly the same manpage as samba.org/samba/docs/man/manpages-3/smb.conf.5.html which I looked at, the problem is that it doesn't seem to matter what octal values I set, I still get the same permissions set on the created file or folder.

                  – Zaz
                  Jan 23 '12 at 11:14











                • Did you set all the options I gave you ? If so, please update your first post and at that point I would suggest you file a bug report.

                  – Panther
                  Jan 23 '12 at 16:10






                • 1





                  It already said.. but on closer inspection and testing, adding the 2 to the directory masks did fix the problem. Many thanks. : D

                  – Zaz
                  Jan 23 '12 at 18:37











                • Fantastic, thank you for marking this as the accepted answer, it help others with a similar problem.

                  – Panther
                  Jan 23 '12 at 19:14











                • Samba configuration is overly complex and really hard to understand. For example what is the logical difference between force create and just create... makes no sense. Your hint is a life saver though - thank you!

                  – Matthias Hryniszak
                  Feb 27 '16 at 19:55














                • 1





                  Yes, that seems to be roughly the same manpage as samba.org/samba/docs/man/manpages-3/smb.conf.5.html which I looked at, the problem is that it doesn't seem to matter what octal values I set, I still get the same permissions set on the created file or folder.

                  – Zaz
                  Jan 23 '12 at 11:14











                • Did you set all the options I gave you ? If so, please update your first post and at that point I would suggest you file a bug report.

                  – Panther
                  Jan 23 '12 at 16:10






                • 1





                  It already said.. but on closer inspection and testing, adding the 2 to the directory masks did fix the problem. Many thanks. : D

                  – Zaz
                  Jan 23 '12 at 18:37











                • Fantastic, thank you for marking this as the accepted answer, it help others with a similar problem.

                  – Panther
                  Jan 23 '12 at 19:14











                • Samba configuration is overly complex and really hard to understand. For example what is the logical difference between force create and just create... makes no sense. Your hint is a life saver though - thank you!

                  – Matthias Hryniszak
                  Feb 27 '16 at 19:55








                1




                1





                Yes, that seems to be roughly the same manpage as samba.org/samba/docs/man/manpages-3/smb.conf.5.html which I looked at, the problem is that it doesn't seem to matter what octal values I set, I still get the same permissions set on the created file or folder.

                – Zaz
                Jan 23 '12 at 11:14





                Yes, that seems to be roughly the same manpage as samba.org/samba/docs/man/manpages-3/smb.conf.5.html which I looked at, the problem is that it doesn't seem to matter what octal values I set, I still get the same permissions set on the created file or folder.

                – Zaz
                Jan 23 '12 at 11:14













                Did you set all the options I gave you ? If so, please update your first post and at that point I would suggest you file a bug report.

                – Panther
                Jan 23 '12 at 16:10





                Did you set all the options I gave you ? If so, please update your first post and at that point I would suggest you file a bug report.

                – Panther
                Jan 23 '12 at 16:10




                1




                1





                It already said.. but on closer inspection and testing, adding the 2 to the directory masks did fix the problem. Many thanks. : D

                – Zaz
                Jan 23 '12 at 18:37





                It already said.. but on closer inspection and testing, adding the 2 to the directory masks did fix the problem. Many thanks. : D

                – Zaz
                Jan 23 '12 at 18:37













                Fantastic, thank you for marking this as the accepted answer, it help others with a similar problem.

                – Panther
                Jan 23 '12 at 19:14





                Fantastic, thank you for marking this as the accepted answer, it help others with a similar problem.

                – Panther
                Jan 23 '12 at 19:14













                Samba configuration is overly complex and really hard to understand. For example what is the logical difference between force create and just create... makes no sense. Your hint is a life saver though - thank you!

                – Matthias Hryniszak
                Feb 27 '16 at 19:55





                Samba configuration is overly complex and really hard to understand. For example what is the logical difference between force create and just create... makes no sense. Your hint is a life saver though - thank you!

                – Matthias Hryniszak
                Feb 27 '16 at 19:55













                8














                After a lot of trial and error, this is the correct code to share samba dir using SGID and unix groups. If user connects anonymously he gets r/o, if he logs in and is a member of assigned group he gets r/w.



                I have group named 'admin' set as primary group to users with write privileges, everyone else gets read only rights.



                I force user to nobody, so different people working on same files don't interfere with each other.



                I set chmod 2755 on shared directory, so it inherits created directories with the same group 'admin'



                $ chmod -R 2755 /home/shares/test


                Checking if all is good:



                $ stat /home/shares/test
                Access: (2755/drwxr-sr-x) Uid: (65534/ nobody) Gid: ( 1001/ admin)


                Relevant part of /etc/samba/smb.conf:



                [test]
                comment = test
                path = /home/shares/test
                force user = nobody
                read only = No
                create mask = 0664
                force create mode = 0664
                directory mask = 02775
                force directory mode = 02775


                This post put me on right track, but testparm revealed 4 incorrect directives, so I'm sharing fixed config here. In samba, the less directives you specify the better it works.






                share|improve this answer




























                  8














                  After a lot of trial and error, this is the correct code to share samba dir using SGID and unix groups. If user connects anonymously he gets r/o, if he logs in and is a member of assigned group he gets r/w.



                  I have group named 'admin' set as primary group to users with write privileges, everyone else gets read only rights.



                  I force user to nobody, so different people working on same files don't interfere with each other.



                  I set chmod 2755 on shared directory, so it inherits created directories with the same group 'admin'



                  $ chmod -R 2755 /home/shares/test


                  Checking if all is good:



                  $ stat /home/shares/test
                  Access: (2755/drwxr-sr-x) Uid: (65534/ nobody) Gid: ( 1001/ admin)


                  Relevant part of /etc/samba/smb.conf:



                  [test]
                  comment = test
                  path = /home/shares/test
                  force user = nobody
                  read only = No
                  create mask = 0664
                  force create mode = 0664
                  directory mask = 02775
                  force directory mode = 02775


                  This post put me on right track, but testparm revealed 4 incorrect directives, so I'm sharing fixed config here. In samba, the less directives you specify the better it works.






                  share|improve this answer


























                    8












                    8








                    8







                    After a lot of trial and error, this is the correct code to share samba dir using SGID and unix groups. If user connects anonymously he gets r/o, if he logs in and is a member of assigned group he gets r/w.



                    I have group named 'admin' set as primary group to users with write privileges, everyone else gets read only rights.



                    I force user to nobody, so different people working on same files don't interfere with each other.



                    I set chmod 2755 on shared directory, so it inherits created directories with the same group 'admin'



                    $ chmod -R 2755 /home/shares/test


                    Checking if all is good:



                    $ stat /home/shares/test
                    Access: (2755/drwxr-sr-x) Uid: (65534/ nobody) Gid: ( 1001/ admin)


                    Relevant part of /etc/samba/smb.conf:



                    [test]
                    comment = test
                    path = /home/shares/test
                    force user = nobody
                    read only = No
                    create mask = 0664
                    force create mode = 0664
                    directory mask = 02775
                    force directory mode = 02775


                    This post put me on right track, but testparm revealed 4 incorrect directives, so I'm sharing fixed config here. In samba, the less directives you specify the better it works.






                    share|improve this answer













                    After a lot of trial and error, this is the correct code to share samba dir using SGID and unix groups. If user connects anonymously he gets r/o, if he logs in and is a member of assigned group he gets r/w.



                    I have group named 'admin' set as primary group to users with write privileges, everyone else gets read only rights.



                    I force user to nobody, so different people working on same files don't interfere with each other.



                    I set chmod 2755 on shared directory, so it inherits created directories with the same group 'admin'



                    $ chmod -R 2755 /home/shares/test


                    Checking if all is good:



                    $ stat /home/shares/test
                    Access: (2755/drwxr-sr-x) Uid: (65534/ nobody) Gid: ( 1001/ admin)


                    Relevant part of /etc/samba/smb.conf:



                    [test]
                    comment = test
                    path = /home/shares/test
                    force user = nobody
                    read only = No
                    create mask = 0664
                    force create mode = 0664
                    directory mask = 02775
                    force directory mode = 02775


                    This post put me on right track, but testparm revealed 4 incorrect directives, so I'm sharing fixed config here. In samba, the less directives you specify the better it works.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered May 17 '14 at 4:46









                    Andrius KAndrius K

                    8111




                    8111























                        5














                        I had the same problem, but everything like mask directives did not work for me (Samba 4.3.11):



                         create mask = 0664
                        force create mode = 0664
                        directory mask = 02775
                        force directory mode = 02775


                        The only option that worked was under the [global] or share section:



                         inherit permissions = yes


                        Just change all folder and file permissions to your need, so future folders and files will inherit the same permissions.






                        share|improve this answer
























                        • I am using Samba version 4.7.6-Ubuntu. And this is working for me too.

                          – Andi S.
                          Jul 20 '18 at 7:00
















                        5














                        I had the same problem, but everything like mask directives did not work for me (Samba 4.3.11):



                         create mask = 0664
                        force create mode = 0664
                        directory mask = 02775
                        force directory mode = 02775


                        The only option that worked was under the [global] or share section:



                         inherit permissions = yes


                        Just change all folder and file permissions to your need, so future folders and files will inherit the same permissions.






                        share|improve this answer
























                        • I am using Samba version 4.7.6-Ubuntu. And this is working for me too.

                          – Andi S.
                          Jul 20 '18 at 7:00














                        5












                        5








                        5







                        I had the same problem, but everything like mask directives did not work for me (Samba 4.3.11):



                         create mask = 0664
                        force create mode = 0664
                        directory mask = 02775
                        force directory mode = 02775


                        The only option that worked was under the [global] or share section:



                         inherit permissions = yes


                        Just change all folder and file permissions to your need, so future folders and files will inherit the same permissions.






                        share|improve this answer













                        I had the same problem, but everything like mask directives did not work for me (Samba 4.3.11):



                         create mask = 0664
                        force create mode = 0664
                        directory mask = 02775
                        force directory mode = 02775


                        The only option that worked was under the [global] or share section:



                         inherit permissions = yes


                        Just change all folder and file permissions to your need, so future folders and files will inherit the same permissions.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Mar 6 '17 at 17:22









                        MedoxMedox

                        7111




                        7111













                        • I am using Samba version 4.7.6-Ubuntu. And this is working for me too.

                          – Andi S.
                          Jul 20 '18 at 7:00



















                        • I am using Samba version 4.7.6-Ubuntu. And this is working for me too.

                          – Andi S.
                          Jul 20 '18 at 7:00

















                        I am using Samba version 4.7.6-Ubuntu. And this is working for me too.

                        – Andi S.
                        Jul 20 '18 at 7:00





                        I am using Samba version 4.7.6-Ubuntu. And this is working for me too.

                        – Andi S.
                        Jul 20 '18 at 7:00











                        2














                        There is a very similar problem when connecting from other Unix / Linux / OSX / MacOS devices: all of the settings are ignored unless you specify



                        [global]

                        unix extensions = no


                        And connect with smb://<serverhost> instead of cifs://<serverhost>.






                        share|improve this answer






























                          2














                          There is a very similar problem when connecting from other Unix / Linux / OSX / MacOS devices: all of the settings are ignored unless you specify



                          [global]

                          unix extensions = no


                          And connect with smb://<serverhost> instead of cifs://<serverhost>.






                          share|improve this answer




























                            2












                            2








                            2







                            There is a very similar problem when connecting from other Unix / Linux / OSX / MacOS devices: all of the settings are ignored unless you specify



                            [global]

                            unix extensions = no


                            And connect with smb://<serverhost> instead of cifs://<serverhost>.






                            share|improve this answer















                            There is a very similar problem when connecting from other Unix / Linux / OSX / MacOS devices: all of the settings are ignored unless you specify



                            [global]

                            unix extensions = no


                            And connect with smb://<serverhost> instead of cifs://<serverhost>.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Aug 17 '16 at 15:30









                            Andrea Lazzarotto

                            5,89822649




                            5,89822649










                            answered Aug 17 '16 at 1:55









                            Erik CarlseenErik Carlseen

                            211




                            211























                                0














                                 Here add this code to the sudo nano smb.conf
                                and restart sudo service smbd restart and access from another local PC/computer using connect with smb://<serverhost> to create or edit files/folder html is folder name

                                [html]
                                comment = admin access
                                path = /var/www/html
                                browsable = yes
                                guest ok = no
                                writable = yes
                                valid users = @admin
                                create mask = 664
                                force create mode = 664
                                security mask = 664
                                force security mode = 664
                                directory mask = 2775
                                force directory mode = 2775
                                directory security mask = 2775
                                force directory security mode = 2775




                                share








                                New contributor




                                ghanshyam nakiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.

























                                  0














                                   Here add this code to the sudo nano smb.conf
                                  and restart sudo service smbd restart and access from another local PC/computer using connect with smb://<serverhost> to create or edit files/folder html is folder name

                                  [html]
                                  comment = admin access
                                  path = /var/www/html
                                  browsable = yes
                                  guest ok = no
                                  writable = yes
                                  valid users = @admin
                                  create mask = 664
                                  force create mode = 664
                                  security mask = 664
                                  force security mode = 664
                                  directory mask = 2775
                                  force directory mode = 2775
                                  directory security mask = 2775
                                  force directory security mode = 2775




                                  share








                                  New contributor




                                  ghanshyam nakiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                  Check out our Code of Conduct.























                                    0












                                    0








                                    0







                                     Here add this code to the sudo nano smb.conf
                                    and restart sudo service smbd restart and access from another local PC/computer using connect with smb://<serverhost> to create or edit files/folder html is folder name

                                    [html]
                                    comment = admin access
                                    path = /var/www/html
                                    browsable = yes
                                    guest ok = no
                                    writable = yes
                                    valid users = @admin
                                    create mask = 664
                                    force create mode = 664
                                    security mask = 664
                                    force security mode = 664
                                    directory mask = 2775
                                    force directory mode = 2775
                                    directory security mask = 2775
                                    force directory security mode = 2775




                                    share








                                    New contributor




                                    ghanshyam nakiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.










                                     Here add this code to the sudo nano smb.conf
                                    and restart sudo service smbd restart and access from another local PC/computer using connect with smb://<serverhost> to create or edit files/folder html is folder name

                                    [html]
                                    comment = admin access
                                    path = /var/www/html
                                    browsable = yes
                                    guest ok = no
                                    writable = yes
                                    valid users = @admin
                                    create mask = 664
                                    force create mode = 664
                                    security mask = 664
                                    force security mode = 664
                                    directory mask = 2775
                                    force directory mode = 2775
                                    directory security mask = 2775
                                    force directory security mode = 2775





                                    share








                                    New contributor




                                    ghanshyam nakiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.








                                    share


                                    share






                                    New contributor




                                    ghanshyam nakiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.









                                    answered 4 mins ago









                                    ghanshyam nakiyaghanshyam nakiya

                                    11




                                    11




                                    New contributor




                                    ghanshyam nakiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.





                                    New contributor





                                    ghanshyam nakiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.






                                    ghanshyam nakiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Ask Ubuntu!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f97669%2fi-cant-get-samba-to-set-proper-permissions-on-created-directories%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        GameSpot

                                        日野市

                                        Tu-95轟炸機