On Wed, Jul 17, 2013 at 5:23 PM, Cameron Simpson <cs@zip.com.au> wrote:
>
>
<snip>
>
> When you start using "su" you have some pitfalls to consider. Many
> programs rely on the $HOME environment variable to decide where
> files should go. If you use "su user2" instead of "su - user2" then
> $HOME will probably be user1's home directory. Chaos ensues.
The manual maintained at GNU.org is fairly clear that $HOME is set, so
chaos should be avoided. I copied what is relevant below:
----
<http://www.gnu.org/software/coreutils/manual/html_node/su-invocation.html>
"By default, su does not change the current directory. It sets the
environment variables HOME and SHELL from the password entry for user,
and if user is not the super-user, sets USER and LOGNAME to user. By
default, the shell is not a login shell."
----
Do you use a different su? If not, give it a try. Open a terminal
and switch to a new user with just 'su user', then after password
entry type "echo $HOME". It should return the home directory of
whatever user you specified.
For the record, I am not saying don't use "-" or "-l" as appropriate
with su. I am also not suggesting appropriate use of the su program,
as that is at the discretion of a given system administrator and (in
my opinion) varies depending on how a system is used.
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (14) |
No comments:
Post a Comment