cybrkyd

How to rsync media to a Jellyfin server with correct ownership and permissions

 Sun, 09 Nov 2025 18:39 UTC

This is a very handy tip that I stumbled upon today. With the Jellyfin client for Android TV, I could not delete watched movies and episodes. To do so, I would need to log on to the Admin page in my browser and do it from there. This is not very convenient for situations where, for example, the kids have watched something and want to delete it themselves.

It transpired that the server’s user jellyfin was not the owner of the media files and this was preventing the deletion from working when performed on the client. Changing ownership of files is easy enough with the chown command, but then every new file sent to the server with rsync was dropped onto the server as another user who was not “jellyfin”. This presents a problem: the files on the server need to be owned by user “jellyfin”.

The user “jellyfin” does not have ssh access and has no password. My initial solution was therefore to:

  1. rsync to a drop folder at /mnt/drop
  2. on the server, sudo chown the files to jellyfin:jellyfin
  3. Then sudo mv files to /mnt/jellyfin which is owned by jellyfin:jellyfin

That is an overly complicated workflow just to upload files.

Today I learned a much easier way. The first step is to setup passwordless sudo for the SSH-User to run rsync as “jellyfin”.

# Edit sudoers
sudo visudo

# Add this line:
SSH-User ALL=(jellyfin) NOPASSWD: /usr/bin/rsync

Once done, the rsync command needs a little tweak to deposit the files as “jellyfin”.

rsync -avP --rsync-path="sudo -u jellyfin rsync" /local/media/ SSH-User@server:/mnt/jellyfin/

This little tweak has saved me a lot of hassle, both on the client deletion front and when uploading new files. Now anyone in the house can delete watched shows directly from Jellyfin, and I no longer need to babysit the file ownership every single time I add new files.

»
Tagged in: #Jellyfin #rsync

Visitors: Loading...