bashrc comportamento difere ao abrir uma sessão ou abrir um terminal

2

Estou usando o RHEL 6.6. Eu tenho um problema ao configurar meu arquivo .bashrc . Eu tenho um sudo su - dummy seguido por um exit nele. Quando abro um terminal, o usuário atual é alterado para dummy . Se eu digitar exit , volto ao usuário anterior, então o exit do .bashrc é executado e fecha as janelas. Perfeito.

Mas quando eu faço o login, o sudo su - dummy é executado, então o seguinte exit é executado imediatamente e sai imediatamente ...

Por que se comporta assim? Existe uma solução alternativa?

    
por Encore 10.02.2015 / 09:16

1 resposta

2

Tem certeza de que su - dummy é executado quando você faz login? Você tem certeza de que seu .bashrc é processado quando você faz o login? bash(1) diz:

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists.  After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.  The --noprofile option may be used when the shell is started to inhibit this behavior.

Então, você pode precisar colocar seu comando su - dummy em qualquer um dos ~/.bash_profile , ~/.bash_login e ~/.profile que você tem.

    
por 10.02.2015 / 09:39