Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to run a command as another user in Linux. Here is what I run:

su user1 -c '/bin/mkdir /tmp/zz'

However, this gives me this error:

fatal: unrecognized command '/bin/mkdir /tmp/zz'
share|improve this question
su user1 -c '/bin/mkdir /tmp/zz' works for me (using Ubuntu Precise). What is the shell of user1? – Mark Wagner Apr 9 '13 at 23:54

You need to swap the single quotes for double quotes. Not that these are only required with commands that take parameters, or if you chain several commands together.

su user1 -c "/bin/mkdir /tmp/zz"
share|improve this answer
Now that's cute. The guy who downvoted me culled his own response, but didn't change his mind on my answer. :( – tink Apr 22 '13 at 23:49

As suggested by Mark Wagner, I encountered the same problem when the user had a non-standard shell (in my case it was git-shell). And the solution was to do:

su -s /bin/bash -c 'some command'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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