Parece que el entorno necesario para que el sistema encuentre los componentes ruby instalados se especifica en un archivo que solo se lee para los shells de inicio de sesión. La página del manual de bash tiene esto que decir sobre la diferencia entre los shells de inicio de sesión y los shells de no inicio de sesión:
INVOCATION
A login shell is one whose first character of argument zero is a -, or
one started with the --login option.
y
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.
mientras
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.
Por lo tanto, si las variables de entorno ruby están en /home/rails/.profileo /etc/profilepor ejemplo, se agregarán al entorno de shell
- invocando explícitamente un shell de inicio de sesión usando
su -l railso su --login railso la taquigrafíasu - rails
- cuando el usuario
railsinicia sesión a través de SSH
- iniciando una subshell como
bash --logindespués de iniciar sesión
Si desea establecer el entorno de ruby independientemente de cómo cambie al usuario rails, puede mover las definiciones de variables relevantes al usuario ~/.bashrc.
su? O algo comosu -losu --?). ¿Cuál es el shell de inicio de sesión para los "carriles" del usuario? ¿Modificó la variable PATH del usuario y, de ser así, en qué archivo (~/.profileo~/.bashrco~/.bash_profileo ...?)