0

I have a shared Folder with Samba running on a CentOS Machine. The folder is called "proyect", and it must be accessed only for the users that belong to the group of the same name with windows clients (Disk Drive). This is how it is configured in smb.conf:

[proyect]
    path = /var/samba/proyect
    valid users = @proyect
    browseable = yes
    writeable = yes
    guest ok = no
    read only = no

This works great at this point, but my problem happens when I need to create a personal folder for every user of the group "proyect" inside "proyect" folder. I want that every user that belongs to "proyect" group can only read the contents of the personal folders of the other users, and that only the owner of the folder can write and at the same time can create more folders inside and files that inherit the same permissions. I created a folder called "carlos" that belongs to the user carlos (i will do for every user and they will cannot delete it or change its name), and i used chown command for set him as the owner of this but still it cannot write inside the folder or create files.

Inside the proyect folder i will create a folder (maybe as root user) for every user that belongs to the group and they will not be able to delete that folder or change its name. The users that belong to the group proyect will only be able to create or modify files inside their personal folder and they will cannot create or modify directories or files directly in the proyect folder, but they will only be able to access to read all the folders inside proyect folder. The folders structure will look like this:

   proyect 
       ---alex
       ---carlos
       ---tom

Every user will have a folder with his name inside proyect folder. None of them will can create folders or files inside the project folder, they can only do it inside their own folder. User carlos will be able to read the content of alex and tom folders, but will not be able to write (create files or directories) inside. User carlos only will create files or folders inside carlos folder. Actually i have this directory structure on windows server, but i need to migrate it to CentOS.

Thanks in advance

  • Is the Samba server authenticating via AD or do the users enter the samba username and password when they connect? – Nasir Riley Apr 22 at 2:21
  • I connect to the shared folder with username and password. – Carlos AC Apr 22 at 4:08
0

I am going to take it that the proyect group and the user(s) that you are connecting as exist on the CentOS machine with the user(s) being members of the group.

First, make sure that the proyect group owns and has read and write access to /var/samba/project:

chown :proyect /var/samba/project

chmod 775 /var/samba/project

If you add this line to smb.conf:

write list = @proyect

The users will be able to write to /var/samba/proyect. As long as the default umask is in place, they'll be able to create folders to which everyone else has read and execute (to traverse) but that only they can write to.

Be sure to restart the service after making the changes:

service smb restart
  • Thanks for your help @Nasir Riley. But it didn't work. First I tried adding only write list without success, and then I added more lines but i get the same results. Finally the smb.conf looks like this: [proyect] path = /var/samba/proyect valid users = @proyect browseable = yes writeable = yes guest ok = no read only = no write list = @proyect create mask = 660 directory mask = 2770 – Carlos AC Apr 22 at 20:45
  • @CarlosAC See my update. The group needs to be able to write to the directory via Unix permissions as well as smb permissions. – Nasir Riley Apr 22 at 23:28
  • Thanks again @Nasir Riley, but it still doesn't work as i expect. I edited my answer adding a more detailed explanation about what I really need. – Carlos AC May 6 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.