linuxserver / docker-transmission

GNU General Public License v3.0
577 stars 179 forks source link

[BUG] UMASK does not affect `settings.json` #272

Open zwimer opened 7 months ago

zwimer commented 7 months ago

Is there an existing issue for this?

Current Behavior

When starting the container, settings.json is chmod' 400.

ls -la /path/to/settings.json gives -r--r----- 1 transmission 2852 Jan 7 02:36 seedbox/config/transmission/config/settings.json

Expected Behavior

ls -la /path/to/settings.json should give -rw-r----- 1 transmission 2852 Jan 7 02:36 seedbox/config/transmission/config/settings.json

Steps To Reproduce

In docker compose file set: UMASK=2

chmod g+rw /path/to/settings.json
docker compose up -d
sleep 1
ls -la /path/to/settings.json

Environment

- OS: Fedora 39
- How docker service was installed: dnf

CPU architecture

x86-64

Docker creation

transmission:
    image: "lscr.io/linuxserver/transmission"
    container_name: "transmission"
    restart: always
    stop_grace_period: 2m
    network_mode: "service:vpn"
    depends_on:
      - "vpn"
    ulimits:
      nofile:
        soft: 107374170
        hard: 107374182
    environment:
      - PUID=${TRANSMISSION_UID}
      - PGID=${TRANSMISSION_GID}
      - TZ=${USER_TZ}
      - UMASK=2
      - USER=${TR_USER}
      - PASS=${TR_PASS}
      - HOST_WHITELIST=secret1,secret2
      - PIA_PORT_FILE=34837
    volumes:
      - ${CONFIG}/transmission/config:/config
      - ${TRANSMISSION}:/cryo/transmission

Container logs

[migrations] started
[migrations] no migrations found
usermod: no changes
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1001
User GID:    1001
───────────────────────────────────────

ln: failed to create symbolic link '/transmissionic/index.html': File exists
ln: failed to create symbolic link '/combustion-release/index.html': File exists
ln: failed to create symbolic link '/flood-for-transmission/index.html': File exists
ln: failed to create symbolic link '/kettu/index.html': File exists
ln: failed to create symbolic link '/transmission-web-control/index.html': File exists
[custom-init] No custom files found, skipping...
Connection to localhost (127.0.0.1) 9091 port [tcp/*] succeeded!
[ls.io-init] done.
github-actions[bot] commented 7 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

NarkyAbyss commented 7 months ago

the environment variable seems to be ignored completely in my case

/# umask
0022
/# printenv
PUID=100
HOSTNAME=<redacted>
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
UMASK=0011
PWD=/
HOME=/root
PGID=101
VIRTUAL_ENV=/lsiopy
S6_VERBOSITY=1
S6_STAGE2_HOOK=/docker-mods
TERM=xterm
SHLVL=1
PS1=$(whoami)@$(hostname):$(pwd)\$
LSIO_FIRST_PARTY=true
PATH=/lsiopy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/bin/printenv

the above container was generated with -e UMASK=0011

LinuxServer-CI commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

zwimer commented 6 months ago

This issue still exists.

drizuid commented 6 months ago

i can confirm that this issue exists

this was initially ignored because the OP didn't understand how umask works and was providing incorrect interpretations of chmods. ie, OP stated chmod 400 results in -r--r----- which is false. then claimed it should be -rw-r----- which was also false. Then implied that umask should chmod files, which is further false (umask is a file creation mask, not something that applies to pre-existing files), hence our statement in the container readme to read about umask before seeking support.

with that said, the issue is this, which narky covered in their reply. providing -e 007 should result in new files being created as 660 and new folders are 770. unfortunately, it doesn't get set.

abc@4873794b7992:/$ umask
0022
abc@4873794b7992:/$ echo $UMASK
007

If i manually bash in and run umask 007 it will work, below test-file is a file that was created prior to manually setting umask, test-file2 is a file created after.

-rw-r--r-- 1 1006 996 0 Feb 25 10:54 test-file  <-- without setting it manually
-rw-rw---- 1 1006 996 0 Feb 25 11:00 test-file2 <-- after setting it manually

test2 is a folder created after setting manually

drwxrwx---  2 1006 996   4096 Feb 25 11:01 test2

we will look into this issue and determine why it is happening.

benniekiss commented 1 month ago

It looks like this file root/etc/s6-overlay/s6-rc.d/init-transmission-config/run is missing a UMASK section to update the settings.json