Jump to content

Changing folder permissions for the future

Hello everyone,

I set up a Linux Server (Ubuntu Server as OS) a few days ago and share files through my local network via samba. However, when I chnage folder permissions recursiveley, every user has acces to the files and can write to them, but as soon as a new folder is being created, only the owner of that specific folder has access to it. As soon as I change permissions again (to everyone in that group) they all have acces again. Since I (we) want to create new folders on a daily basis, it would be very inconvenient to always have to change permissions on the server, rather than everyone in the group having acces to the files naturally. Is there any way that can be achieved?

Thanks in advance

Quote or tag me( @SEAL62 ) if you want me to see your reply

consider a reaction if I was funny, informative, helpful, or agreeable

 

OS: Windows 10 Pro

CPU: Intel i9-9900K GPU: Aorus GeForce RTX 3080 Master Motherboard: Gigabyte Z390 Aorus Master
AIO: Corsair H150i RGB Platinum RAM: Corsair Vengeance RGB Pro 32GB 3000MHz Case: Corsair iCUE 465X RGB PSU: Corsair RM750x White

 

OS: Kali Linux

HP Envy x360 Convertible

CPU: Intel i5-10210U GPU: NVIDIA GeForce MX250 RAM: 16 GB DDR4 2666 SSD: 512GB PCIe

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, SEAL62 said:

rather than everyone in the group having acces to the files naturally. Is there any way that can be achieved?

Just add the following lines to smb.conf for the share:

Quote

create mask = 0666
directory mask = 0777

This sets the default-permissions for new files and folders on the share.

Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to comment
Share on other sites

Link to post
Share on other sites

18 minutes ago, WereCatf said:

Just add the following lines to smb.conf for the share:

This sets the default-permissions for new files and folders on the share.

Do I have to add those masks to the config of the shared folder, too?

my current config includes for each shared folder:

 force create mode = 0660

 force directory mode = 2770

Quote or tag me( @SEAL62 ) if you want me to see your reply

consider a reaction if I was funny, informative, helpful, or agreeable

 

OS: Windows 10 Pro

CPU: Intel i9-9900K GPU: Aorus GeForce RTX 3080 Master Motherboard: Gigabyte Z390 Aorus Master
AIO: Corsair H150i RGB Platinum RAM: Corsair Vengeance RGB Pro 32GB 3000MHz Case: Corsair iCUE 465X RGB PSU: Corsair RM750x White

 

OS: Kali Linux

HP Envy x360 Convertible

CPU: Intel i5-10210U GPU: NVIDIA GeForce MX250 RAM: 16 GB DDR4 2666 SSD: 512GB PCIe

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, SEAL62 said:

Do I have to add those masks to the config of the shared folder, too?

my current config includes for each shared folder:

 force create mode = 0660

 force directory mode = 2770

Um, you could instead just fix those permissions instead, then!

Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, WereCatf said:

Um, you could instead just fix those permissions instead, then!

@Kanna

UPDATE:

Folders can be read but nor written to (even the owner can´r write to folders now)

Share Config is:

[DLC]

   path = /media/user/x/samba/DLC

   browseable = yes

   guest ok = yes

   force group = dlcusers

   valid users = @dlcusers

   create mask = 0777

   directory mask = 0777

   force create mode = 0777

   force security mode = 0777

   force directroy mode = 0777

   force directory security mode = 0777

 

From what I know, now every user should be able to pretty much whatever he wants

BTW I am using the users from the linux system itself maybe that could be the problem?

 

Quote or tag me( @SEAL62 ) if you want me to see your reply

consider a reaction if I was funny, informative, helpful, or agreeable

 

OS: Windows 10 Pro

CPU: Intel i9-9900K GPU: Aorus GeForce RTX 3080 Master Motherboard: Gigabyte Z390 Aorus Master
AIO: Corsair H150i RGB Platinum RAM: Corsair Vengeance RGB Pro 32GB 3000MHz Case: Corsair iCUE 465X RGB PSU: Corsair RM750x White

 

OS: Kali Linux

HP Envy x360 Convertible

CPU: Intel i5-10210U GPU: NVIDIA GeForce MX250 RAM: 16 GB DDR4 2666 SSD: 512GB PCIe

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, SEAL62 said:

@Kanna

UPDATE:

Folders can be read but nor written to (even the owner can´r write to folders now)

Share Config is:

[DLC]

   path = /media/user/x/samba/DLC

   browseable = yes

   guest ok = yes

   force group = dlcusers

   valid users = @dlcusers

   create mask = 0777

   directory mask = 0777

   force create mode = 0777

   force security mode = 0777

   force directroy mode = 0777

   force directory security mode = 0777

 

From what I know, now every user should be able to pretty much whatever he wants

BTW I am using the users from the linux system itself maybe that could be the problem?

 

Why did you tag me?

Reminder⚠️

I'm just speaking from experience so what I say may not work 100%

Please try searching up the answer before you post here but I am always glad to help

Link to comment
Share on other sites

Link to post
Share on other sites

6 minutes ago, Kanna said:

Why did you tag me?

you agreed with the solution of @WereCatf so I thought, maybe you could help me, too

Quote or tag me( @SEAL62 ) if you want me to see your reply

consider a reaction if I was funny, informative, helpful, or agreeable

 

OS: Windows 10 Pro

CPU: Intel i9-9900K GPU: Aorus GeForce RTX 3080 Master Motherboard: Gigabyte Z390 Aorus Master
AIO: Corsair H150i RGB Platinum RAM: Corsair Vengeance RGB Pro 32GB 3000MHz Case: Corsair iCUE 465X RGB PSU: Corsair RM750x White

 

OS: Kali Linux

HP Envy x360 Convertible

CPU: Intel i5-10210U GPU: NVIDIA GeForce MX250 RAM: 16 GB DDR4 2666 SSD: 512GB PCIe

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, SEAL62 said:

you agreed with the solution of @WereCatf so I thought, maybe you could help me, too

I really can't just agree that you should try that

Reminder⚠️

I'm just speaking from experience so what I say may not work 100%

Please try searching up the answer before you post here but I am always glad to help

Link to comment
Share on other sites

Link to post
Share on other sites

39 minutes ago, SEAL62 said:

@Kanna

UPDATE:

Folders can be read but nor written to (even the owner can´r write to folders now)

Share Config is:

[DLC]

   path = /media/user/x/samba/DLC

   browseable = yes

   guest ok = yes

   force group = dlcusers

   valid users = @dlcusers

   create mask = 0777

   directory mask = 0777

   force create mode = 0777

   force security mode = 0777

   force directroy mode = 0777

   force directory security mode = 0777

 

From what I know, now every user should be able to pretty much whatever he wants

BTW I am using the users from the linux system itself maybe that could be the problem?

 

You should look over https://wiki.archlinux.org/index.php/Samba for proper configuration of samba

My guess is your creating a samba share without creating samba users.

You should also have a group for samba that you can assign users to for file permissions.

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, Nayr438 said:

You should look over https://wiki.archlinux.org/index.php/Samba for proper configuration of samba

My guess is your creating a samba share without creating samba users.

just checked, Samba users can be listed (pdbedit -L -v) and are correctly configured just as it is being explained on that webpage.

But thanks for that hint

Quote or tag me( @SEAL62 ) if you want me to see your reply

consider a reaction if I was funny, informative, helpful, or agreeable

 

OS: Windows 10 Pro

CPU: Intel i9-9900K GPU: Aorus GeForce RTX 3080 Master Motherboard: Gigabyte Z390 Aorus Master
AIO: Corsair H150i RGB Platinum RAM: Corsair Vengeance RGB Pro 32GB 3000MHz Case: Corsair iCUE 465X RGB PSU: Corsair RM750x White

 

OS: Kali Linux

HP Envy x360 Convertible

CPU: Intel i5-10210U GPU: NVIDIA GeForce MX250 RAM: 16 GB DDR4 2666 SSD: 512GB PCIe

Link to comment
Share on other sites

Link to post
Share on other sites

16 minutes ago, Nayr438 said:

   force create mode = 0777

   force security mode = 0777

   force directroy mode = 0777

   force directory security mode = 0777

What version of Samba are you even using? I'm not aware of any version that supports these lines here.

Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to comment
Share on other sites

Link to post
Share on other sites

16 minutes ago, WereCatf said:

What version of Samba are you even using? I'm not aware of any version that supports these lines here.

4.11.6-ubuntu

Quote or tag me( @SEAL62 ) if you want me to see your reply

consider a reaction if I was funny, informative, helpful, or agreeable

 

OS: Windows 10 Pro

CPU: Intel i9-9900K GPU: Aorus GeForce RTX 3080 Master Motherboard: Gigabyte Z390 Aorus Master
AIO: Corsair H150i RGB Platinum RAM: Corsair Vengeance RGB Pro 32GB 3000MHz Case: Corsair iCUE 465X RGB PSU: Corsair RM750x White

 

OS: Kali Linux

HP Envy x360 Convertible

CPU: Intel i5-10210U GPU: NVIDIA GeForce MX250 RAM: 16 GB DDR4 2666 SSD: 512GB PCIe

Link to comment
Share on other sites

Link to post
Share on other sites

I just did a test run with the Arch wiki and didn't personally have any issues. All I can suggest is to double check everything

Here is a summary of how I setup my test instances, based off the Arch Wiki

 

  • pacman -S samba
  • curl https://git.samba.org/samba.git/?p=samba.git;a=blob_plain;f=examples/smb.conf.default;hb=HEAD > /etc/samba/smb.conf
  • testparm
  • firewall-cmd --permanent --add-service=samba
  • firewall-cmd --reload
  • useradd -m sambashareuser
  • smbpasswd -a sambashareuser
  • pdbedit -L -v
  • mkdir /testshare
  • chown sambashareuser /testshare
  • nano /etc/samba/smb.conf
  • added to the bottom bottom
  • [testshare]
     
  •   comment = Just a testshare
      path = /testshare
      valid users = sambashareuser
      public = no
      writable = yes
      create mask = 0664
      directory mask = 2775
      force create mode = 0664
      force directory mode = 2775
  • testparm
  • systemctl enable --now smb

--------------------------------------------------

  • user shares
  • ---
  • groupadd -r sambashare
  • mkdir /var/lib/samba/usershares
  • chown root:sambashare /var/lib/samba/usershares
  • chmod 1770 /var/lib/samba/usershares
  • nano /etc/samba/smb.conf
  • added to [global]
     
  •   usershare path = /var/lib/samba/usershares
      usershare max shares = 100
      usershare allow guests = yes
      usershare owner only = yes
  • testparm
  • systemctl restart smb  
  • gpasswd sambashare -a sambashareuser
  • mkdir  /testusershare
  • chown sambashareuser:sambashare /testusershare
  • net usershare add testusershare /testusershare 'A test user share' sambashareuser:f guest_ok=n
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×