Jump to content

File creation mask configurable?


Recommended Posts

Posted (edited)

I've created a script that takes various actions on some of my media folders.  In order to ensure that it has appropriate access to all files created by emby the user that the script runs as was made a member of the emby group.   

Based on what I can see, emby used to create .nfo files with 664 permissions, and .jpg files with 644

That seems to have changed in more recent versions to using 644 for both.  

I've checked the emby user's umask and created a file as the process from the shell and it creates them with 664, so I assume that some code within the app is responsible for overriding the default file creation permissions? 

I can work around this by running another script as root via cron to chmod all the files, or by setting an ACL on the media folders but it would be ideal if emby could use 664 when creating files in the media library instead. Is it possible for me to configure this anywhere? Is there any chance you would consider relaxing these permissions in a future release?  I can see the logic for using 644 when the .nfo or art files are being stored in the emby app data folders, but more relaxed permissions would be appropriate when storing .nfo or .jpg along side the media. 

Edited by bruor
Posted (edited)

Assuming emby is started via systemd on your 'linux' then try this

sudo systemctl edit emby-server.service

make it look someting like this:

### Editing /etc/systemd/system/emby-server.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file

[Service]
UMask=002

### Lines below this comment will be discarded

### /lib/systemd/system/emby-server.service
# [Unit]
# Description=Emby Server is a personal media server with apps on just about every device
# After=network.target
#
# [Service]
# EnvironmentFile=/etc/emby-server.conf
# WorkingDirectory=/opt/emby-server
# ExecStart=/opt/emby-server/bin/emby-server
# RestartForceExitStatus=3
# User=emby
#
# [Install]
# WantedBy=multi-user.target

edit: restart emby

Edited by TMCsw
  • Agree 1
Posted

I decided to apply an ACL to the media folder tree instead as I wasn't sure how overriding the service file would work long term in case there are changes to it down the road.  It also seemed like I needed to duplicate all lines already present in the config instead of just adding the umask to test this.  

For future reference and helping anyone who comes across this in the future, here are the steps I took.
 

#make sure emby group owns folder/files and that they are the correct permissions
sudo chown -R scriptuser:emby /path/to/TV
sudo find /path/to/TV -type d -exec chmod 775 {} \;
sudo find /path/to/TV -type f -exec chmod 664 {} \;

#setgid so new files/folders created in exisitng folders are owned by group 
sudo find /path/to/TV -type d -exec chmod g+s {} \;

#set ACL on the folders so that new folders/files created have appropriate group permissions
sudo find /path/to/TV -type d -exec sudo setfacl -d --set g::rwx {} \;

 

  • Thanks 1

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
×
×
  • Create New...