How to achieve that samba can be written but not delete?
2 min readHow to achieve that samba can be written but not delete?
- An American company made 0.7nm chips: EUV lithography machines can’t do it
- CVE-2007-4559 Python vulnerability ignored for 15 years puts 350,000 projects at risk of code execution
- RISC-V only takes 12 years to achieve the milestone of 10 billion cores
- 14000 cores + 450W: RTX 4080 graphics card perfectly replaces the RTX 3080
- Big upgrade: The difference between Bluetooth 5.0 and 5.2
- Geeks Disappointed that RTX 4080/4090 doesn’t come with PCIe 5.0
- What are advantages and disadvantages of different load balancing?
How to achieve that samba can be written but not delete?
How to achieve linux writable and non-deletable, and using POSIX ACL also.
If we are facing below requirement, how to achieve it?
Using POSIX ACL are as follows (different requirements, slightly corrected) shared directory To_manager.
Only the user of manager has full permissions to this directory.
Other users only have permission to copy and create new files in this directory. But you can’t delete the file, you can’t copy the file, and you can’t read the file.
Steps:
1. Change smb.conf as follows
[To_manager]
comment=To_manager
path=/To_manager
writable=yes
create mask =1600
directory mask= 1600
2. Let Linux support POSIX ACL (this POSIX ACL function is officially supported in Linux kernel 2.6, and then back-ported to 2.4 kernel.
Common file systems, such as: ext3, xfs, jfs, and ReiserFS, can be Use ACL. Of course, you need to enable ACL when compiling the kernel.)
We can also add options to /etc/fstab:
/dev/sda1 /home ext3 acl 1 2
3. Write a small script
#!/bin/bash
mkdir /To_manager
chmod 777 /To_manager
chown manager:manager/To_manager
chmod o+t /To_manager
setfacl -md:u:manager:rwx /To_manager
Finally run the script and restart smb.
- DIY a PBX (Phone System) on Raspberry Pi
- How to host multiple websites on Raspberry Pi 3/4?
- A Free Intercom/Paging system with Raspberry pi and old Android phones
- DIY project: How to use Raspberry Pi to build DNS server?
- Raspberry Pi project : How to use Raspberry Pi to build git server?