But after that, esphome is then unable to access ttyUSB0 with a permissions issue. This can only be fixed my removing the user: 1005:1005 section and going back to root.
Does anyone know a way to get a non root user to work with the ESPHome container?
Extra info:
When I go into the container shell I can see that the user is “I have no name!@etc”.
I have tried adding the esphome user (1005) to the dialout group but that was no help either.
You will need to look at the permissions of the serial port, see what the group membership is and then ensure the user you are setting the uid to is a member of that same group
If you login to host(Linux?) and look at /etc/passwd you will see a list of user on system
You should ensure 1005 exist and has proper permissions. Read about Linux groups and users. Some say it is better to run container as non root and others say it makes no difference. I’m with the former. I usually create individual user/group for each container and provide user with no home directory and no login capability. Only in cases where usb or other device is used by container do you need ton grant the user additional permissions.
The user exists on the host and like you I have an individual user/group for each container and the user has no login capability.
esphome:x:1005:1005::/home/esphome:/bin/nologin
I’m guessing my problem is with these additional permissions that you mention. What permissions are they exactly and how do I go about changing them?
Edit: Doing my best to look into it. By permissions do you mean changing the owner (to esphome) of ttyUSB0 as well? Perhaps creating a udev rule for the specific device?