Skip to content

problem with runuser command line parsing #399

Closed

Description

@fabiocannizzo

runuser's manual says:
runuser [options] -u user command [argument...]
suggesting that anything passed on the command line after -u user is part of the command and its arguments.

However, the following command generates an error:

# runuser -u myuser ls -l
runuser: options --(shell,fast,command,session,session-command,login) and --user are mutually exclusive

The parser thinks that -l is an argument to runuser, rather than an argument to the command ls.

To get it to work I have to create a shell file (file.sh) containing ls -l, then use:
runuser -u myuser /bin/bash file.sh

Is it a bug or am I missing something obvious?

runuser -V returns runuser from util-linux 2.28.2

Thanks

Activity

  1. karelzak commented on Jan 19, 2017

    @karelzak
    Collaborator

    You have to use "--" as a separator, for example:

    runuser -u myuser -- ls -l
    

    I have updated the man page. Thanks.

  2. fabiocannizzo commented on Jan 19, 2017

    @fabiocannizzo
    Author

    Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions