Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Change permissions within docker container permanently

Featured Replies

Hello!

 

Fairly recently I've started using the docker functionality within unraid. I'm having problems with permissions from within a docker container and i'm a novice at both linux and docker itself.

 

I'm trying to pass through a usb device to my container by id, rather than by "usb device". Because when I do that, it (seemingly) randomly switches from location "/dev/ttACM0" to "/dev/ttACM1" and vice versa. So passing through by id appears to be the way forward.

 

Now i'm passing through a device by id using the following value: 

/dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230807104003-if00:/dev/zigbee

 

Within the container itself, the device now has the following permissions "crw-rw----". With these permissions, the application within the container cannot access the device. When i manually edit the permission within the container using the following command:

chmod a+rwx /dev/zigbee

, the application can acces the device without any problems. The issue with this is that whenever the container is restarted, the permissions obviously get reset. Setting Post Arguments only seem to execute on the host machine, but maybe i'm missing something. How can i "permanently" change the permissions for the passed through device on "/dev/zigbee"?

 

As a note: running the container in privileged mode also allows the application to use the device, but i'm trying to avoid that for obvious reasons.

Edited by Donrenegade

Solved by Donrenegade

  • 2 weeks later...
  • Author
  • Solution

I'm not sure whether this is the intended way to do this, but adding the following has fixes my issues:

Unraid => Docker => Under Docker Containers, select container and edit => Enable Advanced View ...

 

Under Post Arguments, I added the following: 

&& docker exec -u root homeassistant sh -c "chmod a+rwx /dev/zigbee"

 

The device can now be accessed without needing privileged mode!

  • 1 month later...
  • Community Expert

I just stumbled on this post.

I was going to post on the unraid forum 'How to pass through a USB without Privileged mode being ticked'.

You never got any replies, but your solution works fine for me.

Is this the correct way of doing this ?

I am passing through a currentcost device like such - and it would not work unless prilileged :

/dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0:/dev/currentcost

 

  • Community Expert

Back again on this - I just upgraded unraid from 6.12.4 to 6.12.6 and the home assistant docker container lost access to its USB controller.

I changed it to priveleged and it is working again.

 

So did the upgrade to 6.12.6 break this 'process' of adding this to the post arguments :

&& docker exec -u root homeassistant sh -c "chmod a+rwx /dev/currentcost" 

 

I dont want to have to run this as privelaged if I dont have to......

  • 1 month later...

use:

 

advanced view

 

extra parameters 

 

and enter:

 

--device=/dev/ttyUSB0:/dev/ttyUSB0
to pass trough a device without privileged 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.