Running chmod on completion not working

Linux specific questions, problems.
Post Reply
Decoy256
Newbie
Newbie
Posts: 2
Joined: Tue May 27, 2025 4:22 pm

Running chmod on completion not working

Post by Decoy256 »

qBittorent's system setup:
qBT-nox (ver. 4.5.1) running in a privileged Proxmox (ver. 8.4.1) container that is running Ubuntu server (ver. 23.04).
Plex server also running in same type of container.
TKL File Server also running in a container with Debian 12 as the OS. (Only relevant in that it provides the Samba shares to PCs on local network.)
Proxmox main server has a directory /storage/media/ with subdirectorys 'download', 'movies', 'tvshows', etc...
The /storage/media directory is mounted in the Plex and qBT containers as /mnt/media for both, so file paths are the same between containers.

Permissions/Users:
Running ps -aux -C qbittorrent-nox shows that qBT-nox is running as root.
Torrent files are owned by root:media and downloaded to '/mnt/media/download'.
Members of "media" group: plex, decoy256, torrent (username isn't really 'decoy256', only for public discussion purposes)
Windows PC username is also decoy256 and accesses the downloaded files through the Samba share with appropriate password. PC user can see all files/directories in the Samba share. When file permissions are set correctly (see issues below), decoy256 can (and should be able to) move/delete/rename files/directories.

Goal/Issue:
Once a torrent is completed, from the Windows PC, I want to manually move it from the /mnt/media/download directory to one of the appropriate category directories in /mnt/media (i.e movies, tvshows, etc).
To do this, the permissions for the files needs to be 770 or else decoy256 cannot move the files.
I have run chmod -R 2770 /mnt and can verify that /mnt and all subdirectories have 2770 permissions.
However, whenever a file is created by a qBT torrent, it gets 755 permission.
My work around idea was to do a Run External Program on torrent completion (and on torrent added, just to make sure) with the command "chmod -R /mnt/media/download/*".
However, it hasn't been working and when I run 'systemctl status qbittorrent-nox', it has line after line that says:
May 26 03:53:48 [myservername] qbittorrent-nox[12103]: /usr/bin/chmod: cannot access '/mnt/media/download/*': No such file or directory
Questions:
Can anyone tell me why directories aren't inheriting 2770?
Also, why is it giving my this "cannot access" error? qBT is running as root, so why does it think the file/directory doesn't exist?

I'd be satisfied with the Run External Program working, but it would be ideal if it would simply create the files with the proper inheritances because I would like to be able to run unrar on downloads (I don't want to mess with doing a script because I've seen others having further problems when trying to do that and I don't need to do a ton of stuff, just make sure the permissions are correct and ideally run unrar.)

Any and all assistance is greatly appreciated.

Additional info:
I will also note that the contents of /usr/lib/systemd/system/[email protected] are:
[Unit]
Description=qBittorrent-nox service for user %I
Documentation=man:qbittorrent-nox(1)
Wants=network-online.target
After=local-fs.target network-online.target nss-lookup.target

[Service]
Type=simple
PrivateTmp=false
User=%i
ExecStart=/usr/bin/qbittorrent-nox
TimeoutStopSec=1800

[Install]
WantedBy=multi-user.target
And when I run systemctl status it does say
qBittorrent-nox service for user root
Decoy256
Newbie
Newbie
Posts: 2
Joined: Tue May 27, 2025 4:22 pm

Re: Running chmod on completion not working

Post by Decoy256 »

Turns out my issue was not having the umask set correctly. Added 'UMask=0002' to the end of /lib/systemd/system/[email protected], restarted the service and now it works as it should.
Post Reply