[Bug 1100775] [NEW] Man page incorrectly states that '-' must be last
maf
maf at tkrat.org
Thu Jan 17 13:46:36 UTC 2013
Public bug reported:
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.
** Affects: shadow (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, 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:
New
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
More information about the foundations-bugs
mailing list