← Back to team overview

touch-packages team mailing list archive

[Bug 1100775] Re: Man page incorrectly states that '-' must be last

 

** Changed in: shadow (Ubuntu)
   Importance: Undecided => Low

** Tags added: manpage

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to shadow in Ubuntu.
https://bugs.launchpad.net/bugs/1100775

Title:
  Man page incorrectly states that '-' must be last

Status in shadow package in Ubuntu:
  Confirmed

Bug description:
  The manual page for su (shadow version 1:4.1.4.2+svn3283-3ubuntu7)
  states:

         -, -l, --login
             Provide an environment similar to what the user would expect had
             the user logged in directly.

             When - is used, it must be specified as the last su option. The
             other forms (-l and --login) do not have this restriction.

  The last paragraph here is wrong. The option '-' can be used anywhere
  on the command line, as long as it comes before the name of the user
  you want to su to.  So the only place it certainly doe snot work at is
  the last position.

  This can be tested fairly easily. On my system the user 'nobody' does not have a home directory, so su gives an error message when trying to create a login shell for nobody (running as root):
    # su nobody -c true
    # su nobody -c true -l 
    No directory, logging in with HOME=/

  Using this we can eperiment where '-' works:
    # su - nobody -c true
    No directory, logging in with HOME=/
    # su nobody - -c true 
    # su nobody -c true -
    # su -c true - nobody
    No directory, logging in with HOME=/

  Which gives that '-' only works when it comes before the username.
  This is also obvious when one looks at the source. Let me know if I
  need to elaborate on this.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/shadow/+bug/1100775/+subscriptions