Change group permissions on linux shared folder

14,249

From the this page:


.... However, if you're creating a shared directory for group access, you need to perform a few more steps. Let's take a stab at a group share for the accounting department in the smb.conf file:

 [accounting]
    comment = Accounting Department Directory
    writable = yes
    valid users = @account
    path = /home/samba/accounting
    create mode = 0660
    directory mode = 0770

The first thing we did differently is to specify @account as the valid user instead of one or more individual usernames. This is shorthand for saying that the valid users are represented by the Unix group account. These users will need to be added to the group entry account in the system group file ( /etc/group or equivalent) to be recognized as part of the group. Once they are, Samba will recognize those users as valid users for the share.

In addition, you need to create a shared directory that the members of the group can access and point to it with the path configuration option. Here are the Unix commands that create the shared directory for the accounting department (assuming /home/samba already exists):

# mkdir /home/samba/accounting
# chgrp account /home/samba/accounting
# chmod 770 /home/samba/accounting

There are two other options in this smb.conf example, both of which we saw in the previous chapter. These options are create mode and directory mode. These options set the maximum file and directory permissions that a new file or directory can have. In this case, we have denied all world access to the contents of this share. (This is reinforced by the chmod command, shown earlier.)


So at least you'll need to change valid users = @linux and add

    create mode = 0660
    directory mode = 0770

Edit: Above gives the user the ability to create files with these permission (maximum creation rights). It does not force them. So if this does not work you could try adding:

force create mode = 0660
force directory mode = 0770
force user = linux
force group = linux

If that still does not work you could try setting inherit permissions = yes and setting the parent directory manually once on 770.

On this page is some more information about assigning forced rights.

Share:
14,249

Related videos on Youtube

Rinat
Author by

Rinat

Updated on September 18, 2022

Comments

  • Rinat
    Rinat over 1 year

    I have Oracle Linux 5 installed on virtual machine. There is a shared folder created with samba. I can access this folder from my Windows 7 machine and copy files. My problem is, when i copy files to this folder, Group Access permissions changes to None, but I need Access: Read and write (for autodeploying on Weblogic).

    Samba user:linux, machine user(login):linux, group:linux

    smb.conf file:

    [autodeploy]
    path = /home/linux/Oracle/Middleware/user_projects/domains/base_domain/autodeploy
    writeable = yes
    browseable = yes
    valid users = linux
    force user = linux
    force group = linux
    

    Tried to use various chmod and chown commands, but nothing helped. I think prombel is in samba user, but I did't found how to modify samba user group (I'm not sure if it's possible).

    • Neil Neyman
      Neil Neyman over 10 years
      Did you try sudo chgrp linux smb.conf ?
    • Rinat
      Rinat over 10 years
      @Neil Neyman, nope, same result, Permissions-None
  • Rinat
    Rinat over 10 years
    Thanks for answer @Rik, much better, however group permissions is now set to "no read, write". Tried to set different create mode, but nothing. Can't get "Read and write" permissions. Maybe I miss something...
  • Rik
    Rik over 10 years
    I added some information to my answer about forcing create mode. The normal create mode only gives the ability to create files with this maximum permission. It does not force the client to set it to this maximum. Force create mode does.
  • msmafra
    msmafra over 9 years
    Am I not supposed to use RSAT or compmgmt.msc do define groups/users that have access?
  • Rik
    Rik over 9 years
    @tenshimsm We were talking about a Linux Samba server here. So all these groups and permissions are regulated in Samba/Linux (which has nothing to do with RSAT or compmgmt.msc).
  • msmafra
    msmafra over 9 years
    That's extremely confusing because I'm following Samba's Wiki orientations goo.gl/q2vXYR and every guide/tutorial show that the Windows groups/users are managed by Windows tools. What I really have problems with are the permissons inside linux ext4 file system that spontaneously make files readonly or block sub folders access without any change from my part.