Man page incorrectly states that '-' must be last
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
shadow (Ubuntu) |
Confirmed
|
Low
|
Unassigned |
Bug Description
The manual page for su (shadow version 1:4.1.4.
-, -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.
Changed in shadow (Ubuntu): | |
status: | New → Confirmed |
Changed in shadow (Ubuntu): | |
importance: | Undecided → Low |
tags: | added: manpage |