De su
la page de manuel :
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
Il est difficile de dire s'il y a une différence entre -
et --login
(ou soi-disant juste -l
). A savoir, la page de manuel indique "au lieu de son raccourci -", mais toutes ces options sont regroupées, et je ne vois pas d'explication sur la différence, si elle existe.
UPD J'ai vérifié la question, qui est censée résoudre mon problème. La question porte essentiellement sur la différence entre su
et su -
. Et je pose des questions sur la différence entre su -
et su --login
. Donc non, ça ne résout pas du tout.
Réponse acceptée :
L'entrée manuelle de Debian semble être plus éclairante :
-, -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 before any username. For portability it is
recommended to use it as last option, before any username. The other forms (-l
and --login) do not have this restriction.