When I type in my console "runuser", I am getting "command not found". I though this command was pretty standard, but I cannot find it on my system.

I am on the root user but I do not have the password of the other user.

  • Please justify when you click on "-1" on a question. Thank you. – user37220 Jun 26 '13 at 12:57
  • 1
    I didn't downvote this (yet), but if you mouse over the down arrowhead, it says "this question does not show any research effort; it is unclear or not useful". If a downvote appears without further comment, you may reasonably assume that that's what the voter thought of your question. – MadHatter Jun 26 '13 at 12:59
  • 1
    runuser is intended for use by system services which need to change UID and preserve their SELinux security contexts. This is not a command that you should be running yourself. – Michael Hampton Jun 26 '13 at 14:51

From your comment on the other answer:

When I do su - otheruser, I am getting No directory, logging in with HOME=/. Then when I run whoami, I get root.

This happens because 'otheruser' hasn't got a shell (like bash). It's probably something like /bin/false. If you want a shell as 'otheruser', use this instead:

sudo -u otheruser /bin/bash
  • 1
    This doesn't answer the main question. – reinierpost Jan 19 '16 at 18:34

On Ubuntu you have su and sudo for this sort of thing:

su - username

Changes to user username, as if that user had logged in.

sudo -u username command

Run a single command as user username.

  • 3
    Thanks. However, I am looking for the runuser function because I do not have the password for the other user. – user37220 Jun 26 '13 at 12:56
  • You don't need the password if you set up sudoers. – l0b0 Jun 26 '13 at 12:57
  • When I do "su - otheruser", I am getting "No directory, logging in with HOME=/". Then when I run "whoami", I get "root". – user37220 Jun 26 '13 at 13:00
  • No directory, logging in with HOME=/ is normal if the user has no home directory assigned or the directory doesn't exist. How you get root from whoami is beyond me. – l0b0 Jun 26 '13 at 13:03
  • Yes, the error message is normal. It is the whoami which I do not understand. – user37220 Jun 26 '13 at 13:11

It is in the util-linux package, so if you want it, install that package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.