[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Non interactive ssh connection



This is a cumulative reply to you and Alex, with thanks

My aim is that what is in ~/.bashrc is sourced NON-INTERACTIVELY.
Currently that does not occur and the openmpi parallelization does not
function (the command "mpirun -host <hostname> -n
<number_of_processors> connectivity_c"  fails because a library from
the compiler is not found. That library is sourced from ~/.bashrc,
though interactively. In fact, the command

thisnode$ ssh othernode env | sort

does not show the compiler variables set in there, nor an
LD_LIBRARY_PATH indicating where the compiler libraries are located.


Below the ~/.profile, which is the same in all machine on the internal network.

===============
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
================

Perhaps FOR NON_LOGIN SHELLS, I should place my settings in
/etc/bash.bashrc and have it sourced in /etc/profile. Currently
/etc/bash.bashrc reads:

==========
# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

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

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
# If this is an xterm set the title to user@host:dir
#case "$TERM" in
#xterm*|rxvt*)
#    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
#    ;;
#*)
#    ;;
#esac

# enable bash completion in interactive shells
#if [ -f /etc/bash_completion ]; then
#    . /etc/bash_completion
#fi

# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found ]; then
	function command_not_found_handle {
	        # check because c-n-f could've been removed in the meantime
                if [ -x /usr/lib/command-not-found ]; then
		   /usr/bin/python /usr/lib/command-not-found -- $1
                   return $?
		else
		   return 127
		fi
	}
fi
=================

while /etc/profile reads:

=============
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
fi

if [ "$PS1" ]; then
  if [ "$BASH" ]; then
    PS1='\u@\h:\w\$ '
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

export PATH

umask 022
=================

Thans a lot for indicating how to get things running.
francesco


Thanks
francesco


On Thu, Apr 16, 2009 at 9:15 PM, Jochen Schulz <ml@well-adjusted.de> wrote:
> Francesco Pietra:
>>
>> when I do a non interactive ssh connection, the .bashrc
>> and .bash_profile files in the home directory are not executed during
>> the login. Indeed I need that ssh reads the .bashrc file during a non
>> interactive login, in order to run mpi jobs, that uses program placed in
>> non-conventional paths.
>
> Check the default shell of the user in /etc/passwd. Only bash reads
> .bash_profile. Renaming it to .profile might help (if it doesn't contain
> bashims).
>
> J.
> --
> It is not in my power to change anything.
> [Agree]   [Disagree]
>                 <http://www.slowlydownward.com/NODATA/data_enter2.html>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAknng7sACgkQ+AfZydWK2zmY6gCgqyusFBuyk9i2yf5DW2HlYbdT
> +pgAoJhhyolOyNJ0gwsKyvHKb9ro2Yig
> =1g6u
> -----END PGP SIGNATURE-----
>
>


Reply to: