Parece que o ambiente necessário para o sistema encontrar os componentes ruby instalados é especificado em um arquivo que é lido apenas para shells de login. A página do manual do bash tem a dizer sobre a diferença entre shells de login e shells de não login:
INVOCATION
A login shell is one whose first character of argument zero is a -, or
one started with the --login option.
e
When bash is invoked as an interactive login shell, or as a non-inter‐
active shell with the --login option, it first reads and executes com‐
mands 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.
enquanto que
When an interactive shell that is not a login shell is started, bash
reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
these files exist.
Portanto, se as variáveis de ambiente ruby estiverem dentro /home/rails/.profile
ou /etc/profile
por exemplo, elas serão adicionadas ao ambiente shell
- invocando explicitamente um shell de login usando
su -l rails
ou su --login rails
ou a abreviaçãosu - rails
- quando o usuário
rails
efetua login via SSH
- iniciando um subshell como
bash --login
após o login
Se você deseja que o ambiente ruby seja definido independentemente de como você alterna para o usuário rails
, você pode mover as definições de variáveis relevantes para o usuário ~/.bashrc
.
su
? Ou algo parecidosu -l
ousu --
?). Qual é o shell de login para o usuário "rails"? Será que quis modificar variável PATH do utilizador e em caso afirmativo, em qual arquivo (~/.profile
ou~/.bashrc
ou~/.bash_profile
ou ...?)