Ze su
strony podręcznika użytkownika:
For backward compatibility, su defaults to not change the current directory
and to only set the environment variables HOME and SHELL (plus USER and LOGNAME
if the target user is not root). It is recommended to always use the
--login option (instead of its shortcut -) to avoid side effects caused
by mixing environments.
...
-, -l, --login
Start the shell as a login shell with an environment similar to a real login:
o clears all the environment variables except TERM
o initializes the environment variables HOME, SHELL, USER, LOGNAME, and PATH
o changes to the target user's home directory
o sets argv[0] of the shell to '-' in order to make the shell a login shell
Trudno powiedzieć, czy jest jakaś różnica między -
i --login
(lub podobno tylko -l
). Mianowicie strona podręcznika mówi „zamiast skrótu -”, ale wszystkie te opcje są zgrupowane razem i nie widzę wyjaśnienia różnicy, jeśli w ogóle istnieje.
UPD Sprawdziłem pytanie, które ma rozwiązać mój problem . Pytanie dotyczy w zasadzie różnicy między su
i su -
. I pytam o różnicę między su -
i su --login
. Więc nie, to wcale nie rozwiązuje problemu.
su
i su -
. I pytam o różnicę między su -
i su --login
. Czego tu brakuje?
To avoid side effects caused by mixing environments use --login option or its equivalent -. The first form is recommended because - can be placed only just before username.