.bashrc at ssh login [cerrado]


Cuando me ssh en mi ubuntu-box ejecutando Hardy 8.04, las variables de entorno en mi .bashrc no está establecido.

Si hago una fuente .bashrc, las variables están correctamente establecidas, y todo está bien.

¿Cómo es posible .bashrc no se ejecuta en el inicio de sesión?

Author: Hobhouse, 2009-05-04

4 answers

.bashrc no se obtiene cuando inicia sesión usando SSH. Necesitas buscarlo en tu .bash_profile así:

if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi
 547
Author: Ayman Hourieh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-05-04 15:14:39

Tuve una situación similar a la de Hobhouse. Quería usar comando

 ssh myhost.com 'some_command'

Y 'some_command' existe en '/var/some_location' así que intenté añadir '/ var / some_location ' en el entorno PATH editando 'HOME HOME/.bashrc "

Pero eso no estaba funcionando. porque por defecto .bashrc (Ubuntu 10.4 LTS) evitar de abastecimiento por código como a continuación

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

Así que si desea cambiar el entorno para ssh shell sin inicio de sesión. deberías añadir código encima de esa línea.

 58
Author: ruseel,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-06-13 04:34:50

Para obtener un excelente recurso sobre cómo funciona la invocación de bash, qué hacen los dotfiles y cómo debe usarlos/configurarlos, lea esto:

 30
Author: lhunath,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-05-04 15:50:09

Si la solución de ayman no funciona, intente nombrar su archivo .profile en lugar de .bash_profile. Eso funcionó para mí.

 25
Author: Loïc Wolff,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-05-04 15:19:22