December 9, 20241 yr I'm running a non-community apps docker container, and would like to access the console as a different user than root. Is that possible? I know in portainer it's possible to set the user when attaching to a containers console, but can you do that in unraid? Thank you!
December 10, 20241 yr Community Expert to switch user, if another user exist in the container the command is "su %username%" https://phoenixnap.com/kb/su-command-linux-examples for example in Linux terminal if your login to unraid as root you can login as the nobody user by su nobody
December 10, 20241 yr Community Expert I'm not sure if a added users is saved across reboots but if you have a home folder. the adduser or is it useradd ... different across distros.... comand should exist and generate another user. I use the plugin ssh config tool for use with unriad ssh server. then i can run the passwd comand in unriad termainl to make a user. as Unrad by default won't let you create a managment user outside of root due to acess and other ACL issues. with the ssh config tool: you can add other ssh users and levlage this to have a su in unraid. Due to security and the ssh conf I don't recommend running that tool but then in terminal I would run passwd samba and have a password to the account and then su samba to login to samba stuff. At this level you may ned to have added other setting to grant samba access to stuff. so a usermod -aG root samba in my case to grant samba root access. Then it becomes turtles all the way down. This is really insecure, though! the docker may also not save some of that data on a image update or other settings. Depends on the docker image. Example if you are running a Linux os like steam os, debian in docker, ubuntu in docker. Different accounts exist. you would use docker commands to attach to the docker. In this case Web UI > console then deeding on what's in the linux OS command wise that left form the containerized image. adduser dockeruser su dockeruser
December 10, 20241 yr Community Expert also in terminal if the container has/support bash you can run this command to access as another user: docker exec -u <username or UID> -it <container_name> /bin/bash docker ps to get container name -u select unraid user to run as. The docker exec command allows you to run commands in a running Docker container. Here's a breakdown of the options and syntax: docker exec: This is the base command used to execute commands inside a running container. -u <username or UID>: This option specifies the username or user ID under which the command will run inside the container. If omitted, it defaults to the root user or the user specified in the Dockerfile. -it: This combines two options: -i attaches the terminal session's standard input to the container, allowing interaction (e.g., for command prompts), and -t allocates a pseudo-TTY, which makes it possible to use terminal programs like bash or shells interactively. <container_name>: Replace this with the name or ID of your running container where you want to execute the command. /bin/bash: This is the command being executed inside the container. In this case, it’s starting a bash shell. You can replace this with any command you need to run. So, docker exec -u <username> -it <container_name> /bin/bash starts an interactive shell inside the specified container, running as the specified user. Edited December 10, 20241 yr by bmartino1
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.