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.

When opening console on a docker container, is there a way to set what user that opens as?

Featured Replies

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!

  • 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

 

  • 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.
image.png.09d195767fcb6db1acb9d3d794fc7e65.png

 

with the ssh config tool:
image.png.b46dfc7c65559442413cc86576354981.png

 

you can add other ssh users and levlage this to have a su in unraid.
image.thumb.png.fd6481b200d583937ecd770d8c4cd409.png

 

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
 

  • 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 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.

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.