linuxserver / docker-transmission

GNU General Public License v3.0
582 stars 180 forks source link

RPC username cannot be set #212

Closed adripo closed 1 year ago

adripo commented 1 year ago

linuxserver.io

Trying to log from browser will only work with root as user and the USER configured as ENV during docker run will not work. More details on my config and results inside Current Behavior


Expected Behavior

Current Behavior

docker compose:

...
    environment:
      - USER=admin
      - PASS=noteasypassword
...

inside the container:

root@76025c92219f:/# env
PUID=1000
HOSTNAME=76025c92219f
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
PWD=/
HOME=/root
PGID=1000
TERM=xterm
USER=root
PASS=noteasypassword
SHLVL=1
PS1=$(whoami)@$(hostname):$(pwd)\$ 
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
TRANSMISSION_WEB_HOME=/transmission-web-control
_=/usr/bin/env

Steps to Reproduce

  1. Set USER ENV during docker run
  2. docker exec inside the container
  3. print env
  4. USER=root and not the value set during run
  5. Trying to log from browser will only work with root as user

Environment

OS:- CPU architecture: x86_64 How docker service was installed:

Command used to create docker container (run/create/compose/screenshot)

Docker logs

github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

aptalca commented 1 year ago

You likely did not recreate the container, or did not set the env vars correctly.

You're providing conflicting and incomplete information.

You show us a yaml snippet for two env vars, yet you're saying you're doing docker run.

This seems like user error but we don't have enough info to determine what type. Closing as it is not a bug. We have other channels for config help.

adripo commented 1 year ago

@aptalca Thanks for your answer. I tested a clean version and you are right, everything works as expected. After a little more digging I discovered what my problem is:

My docker-compose is something like this:

services:
  transmission:
    container_name: transmission
    image: lscr.io/linuxserver/transmission
    ports:
      - "9091:9091"
      - "31413:51413"
      - "31413:51413/udp"
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - TRANSMISSION_WEB_HOME=/transmission-web-control
    env_file:
      - transmission.env
    volumes:
    ...

and the transmission.env file contains:

USER=admin
PASS=secret-password

Using an external env file for the USER will not work and will always be overwritten with root. I think this happens because the moment when the env file is loaded is different from when the environment section in docker-compose is loaded, so it gets the default user root. Do you have any clue on that?

adripo commented 1 year ago

@aptalca I have done some more tests and I have more clues on the issue, still cannot resolve it.

The issue happens when I use two $ inside the password. The password is written in a separate file that is passed with env_file

transmission.env:

USER=admin
PASS=test12$$

Using this as password will change the username to root. If you prefer I can contact you on discord.

adripo commented 1 year ago

I found out that the problem explained in my hidden message above persists even without using $$ inside the password