Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

permission change impossible on network drive #462

Open
Neurofibromin opened this issue Jun 26, 2024 · 5 comments
Open

permission change impossible on network drive #462

Neurofibromin opened this issue Jun 26, 2024 · 5 comments

Comments

@Neurofibromin
Copy link

I would like to mount a samba network drive to a docker container for the downloads. This does not work, because metube tries to change permissions on the drive and discard root privileges to write to it. As you may know, even root cannot change ownership/access rights on a samba volume. The ideal solution would be if metube just tried to create every downloaded file as root. Is this possible?
My config:

  metube:
    image: ghcr.io/alexta69/metube
    restart: unless-stopped
    ports:
      - "8081:8081"
    volumes:
      - /mnt/nas:/downloads

The error in the logs:

Setting umask to 022
Creating download directory (/downloads), state directory (/downloads/.metube), and temp dir (/downloads)
Changing ownership of download and state directories to 1000:1000
Running MeTube as user 1000:1000
Traceback (most recent call last):
  File "/app/app/main.py", line 109, in <module>
    dqueue = DownloadQueue(config, Notifier())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/app/ytdl.py", line 208, in __init__
    self.queue = PersistentQueue(self.config.STATE_DIR + '/queue')
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/app/ytdl.py", line 163, in __init__
    os.mkdir(pdir)
PermissionError: [Errno 13] Permission denied: '/downloads/.metube'
@PikuZheng
Copy link
Contributor

I have a similar operating environment. Every time I start metube, it reports lots of errors when modifying permissions, but it does not affect.

I think the key is whether the permissions are configured correctly when the host mounts /mnt/nas. You should first check whether it can be read and written normally, and then map it to the container.

If the host is a synology, I recommend setting the user id to the same as the synology admin's id.

@Neurofibromin
Copy link
Author

The root user can write the folders just fine - in fact the .metube folder gets created. The problems start when metube tries to change the owner of the directory and lowers its privileges to user 1000:1000. I am using Truenas, but this is in fact not dependent on the nas at all - the owner setting is a limitation of the samba protocol itself.

I tried specifying in the compose file user: "0:0" but this changed nothing. I maintain: The ideal solution would be if metube just tried to create every downloaded file as root.

@PikuZheng
Copy link
Contributor

As far as I know compose will change the folder permissions when creating the container. This may cause the folder permissions to not match what you expect.
I don't use compose, and I force read and write permissions when mounting the nas path. See #195 .

set UID: 0 and GID: 0 via environment variables, if you want to try.

@Neurofibromin
Copy link
Author

I am not mounting the cifs share with docker: the cifs drive is already mounted by fstab, so I cannot change the permissions at mount (I'm not allowed to change fstab settings by company policy). I just tried user: "0:0", this does the same thing as UID: 0, GUID: 0. Compose will not change permissions, because fstab does the mounting. Samba does not support changing acls post-mount, pursuing that route is meaningless.

The solution would be if metube just tried to create every downloaded file as root. Is this possible?

@PikuZheng
Copy link
Contributor

I just tried user: "0:0", this does the same thing as UID: 0, GUID: 0

i think the entrypoint.sh query the uid/gid in env only.

The solution would be if metube just tried to create every downloaded file as root. Is this possible?

yes UID: 0 and GID: 0 via env will do this but sometime root user is not 0:0 or disabled (ubuntu for example, root user name is not 'root' by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants