poltchoice.blogg.se

Add sudoers
Add sudoers














RUN useradd -m -s /bin/bash -N -u $UID $USER & \Įcho "$ ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers & \ # Create user and setup permissions on /etc/sudoers Something like the following should work. Sorry about the delay in the response.Īs you already figured out, the way to do it is to (on the Dockerfile) perform all operations that require root operation first, and then change the user. Hi again, thanks for sharing more about the use case. I also noticed that variable substitution in docker-compose.yml does not seem to work (not sure if this would help, anyway). Trouble is that the hostname can be changed by the user (via a device variable) and hence is not known when the docker-compose.yml file is written. Works - but super ugly.Īnother option is to add the hostname in docker-compose.yml (extra_host). The problem with this approach is that exiting the shell (^D) drops into a root shell. The workaround I have is to run as root, and then switch to user in CMD running sudo -u (after adding the hostname to /etc/hosts. I also need root (or sudo) to run the balena entrypoint for UDEV support. newuser cannot add it (nor a script run by CMD.

#Add sudoers password#

The issue is that I cannot provide password free sudo to newuser since the host is not in /etc/hosts.

add sudoers

) and then switch to it with USER newuser. I create the new user in the Dockerfile ( RUN adduser. I am not sure I understand what you are referring to. There are ways to add additional users within the container environment The app exposes a shell terminal to the user, and I prefer that to run with user privileges and password less sudo.














Add sudoers