Skip to content

Instantly share code, notes, and snippets.

@khuralyuvraj
Last active November 26, 2023 02:32
Show Gist options
  • Save khuralyuvraj/6fd12a0cd4373b6c29c338a5107b4d91 to your computer and use it in GitHub Desktop.
Save khuralyuvraj/6fd12a0cd4373b6c29c338a5107b4d91 to your computer and use it in GitHub Desktop.
If you have ever had problems running commands as other users in Ubuntu, this might be helpful.

Executing a command as another user

Now the command to run commands as another user is simply:

su [user] -c [command]

but I couldn't get that to work for me, atleast until I installed the following package:

sudo apt-get install dbus-x11

now if you run the command from before again (su [user] -c [command]), it should work like intended. But if it doesn't, run the following:

sudo apt-get install dbus*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment