LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Prevent clients from deleting files on server (https://www.linuxquestions.org/questions/linux-server-73/prevent-clients-from-deleting-files-on-server-4175664814/)

DDE12 11-23-2019 09:22 PM

Prevent clients from deleting files on server
 
I have Linux Mint 19.2 XFCE acting as a media server (samba shares) for our movies and music. We use various streaming devices and their apps (Firestick, Roku, VLC, Plex...) to access the media files. My end goal is to prevent these devices/apps from deleting the music and movies files but be able to write files they need for their operation (playlists, bookmarks...). I don't know how to accomplish this but some thoughts I had were:
1) Create a samba user that has read, write permission but not delete.
2) Adjust permissions for the music and movie files themselves so that only the owner can delete. The problem with this might be that I would have to adjust permission for each new music or movie file I add in the future.
3) Simply prevent any user that is not physically on the Linux machine from deleting files.
I would greatly appreciate help with this.

pan64 11-24-2019 08:22 AM

you missed an important point: adding and deleting files requires write permission on the directory, not on the file.
I would rather suggest you to make the whole thing read-only and users can put their bookmarks and playlists into (inside) their homes.

DDE12 12-05-2019 08:08 PM

Okay. How do I do that? Is is possible to set up so that clients are read only and I/user directly on the server can have full access? Thanks again.

berndbausch 12-05-2019 09:15 PM

I don't think that the Linux permission system can distinguish between local and remote accounts.

However, since each of your devices has its own account when accessing the Samba server, you could use ACLs to remove write permissions from a directory:
Code:

setfacl -m USER:r-x DIRECTORY
I suppose Samba also allows you to set permissions on shares, but I would have to research the mechanism. Giving control to Samba is the cleaner solution in my opinion.

DDE12 02-16-2020 07:44 PM

I created a new user in Linux named streamer. Then I edited /etc/samba/smb.conf to give me (user1) full read/write access and Streamer read only with
Code:

[SharedMedia]
path = /disks/ExternalMedia/SharedMedia
read only = Yes
valid users = user1, Streamer
write list = user1

See https://forums.linuxmint.com/viewtop...55991#p1755991 for more specific details and troubleshooting for some issues with sharing.


All times are GMT -5. The time now is 02:08 AM.