Qual é a diferença entre 'su -' e 'su --login'?

14

De % man_de% página de manual:

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

É difícil dizer se há alguma diferença entre su e - (ou supostamente apenas --login ). Ou seja, a man page diz "em vez de seu atalho -", mas todas essas opções são agrupadas, e não vejo uma explicação da diferença, se é que existe.

UPD Eu verifiquei a questão, que deve ser resolve meu problema . A questão é basicamente sobre a diferença entre -l e su . E estou perguntando sobre a diferença entre su - e su - . Então, não, não resolve nada.

    
por x-yuri 24.10.2016 / 16:26

2 respostas

11

A entrada manual do Debian parece ser mais esclarecedora:

   -, -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.
    
por 24.10.2016 / 16:42
0

não há diferença, é como correr;

echo bob | grep -v bob
echo bob | grep --invert-match bob

apenas um resumo ...

    
por 24.10.2016 / 16:37

Tags