Hey all, Ill try to keep this short. I am trying to issue a command to another computer using ssh (ex ssh user@host 'csh /home/usr/SCRIPTS/tp.csh) and am getting some annoying error messages. when I run the tp.csh program on the host machine, it runs fine, when I issue the above command from a remote computer, I get 2 different errors:

TERM environment variable not set


error while loading shared libraries: libcudart.so.2: cannot open shared object file: No such file or directory

I cant really go much in to the what of the code as I cant show it. I DO know that I can re-create the first error using the following command:

ssh user@host 'top -u user'

I have heard that the top problem can be fixed by running in batch mode, but need to find a way to get the functions working without that. Is there a flag in ssh im missing? I feel like if I can fix the TERM big (both computers display xterm when I issue the command echo $TERM), then I can fix the other library problem using the same method. Any ideas? Thanks for your time!

At the target machine, in the .ssh/environment add BASH_ENV=.profile (assuming bash as a default shell and the standard setup). Otherwise, many important variables, such as TERM, LD_LIBRARY_PATH, etc, etc would remain undefined.

hm, i am likely being dense but im still having a problem, so didnt have a .ssh/environment file, so I created one in that area using emacs. I get the following now:

~>cat .ssh/environment
and when I run the code, im still getting the same error. I am trying to do some googling but must not be looking for the right thing. I see that there is something in that has to do with bash, a file called profile. I dont know where it is but maybe I need to fix something additional? I should mention I am not root on either machine, but can ask root to make changes as well if they need to make changes. Thanks for all your help so far.

FYI, I found a temporary tho non-ideal solution, I can do the following and all works well:

ssh usr@host "export TERM=xterm; export LD_LIBRARY_PATH=LD_LIBRARY_PATH=/opt/intel/Compiler/11.1/064/lib/intel64:/usr/local/cuda/lib;csh /home/path/tp.csh"

I would love to find a better solution tho along the lines we are discussing above.

> BASH_ENV=profile

It is [B].[/B]profile . The dot is rather hard to see, so it is dot-profile.

ok, I added the . to profile and now have:

~/.ssh>cat environment

I still get the same errors and when I do an ssh usr@host 'env' command I am missing the same environmental variables. I wonder if it has to do with needing to add PermitUserEnvironment to the /etc/ssh/sshd_config file, which I will need to ask my admin to do. Do you think this would help?

What is there in your .profile? It usually defines and exports all the necessary environment variables. If it does not, add them there.

~>cat .profile

# ~/.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
#umask 022

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

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


And for the possible next question, here is .bashrc

~>cat .bashrc

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

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

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth

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

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# 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)

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        # We have color support; assume it's compliant with Ecma-48
        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
        # a case would tend to support setf rather than setaf.)

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

#if [ -f ~/.bash_aliases ]; then
#    . ~/.bash_aliases

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ] && [ -x /usr/bin/dircolors ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'
    #alias dir='ls --color=auto --format=vertical'
    #alias vdir='ls --color=auto --format=long'

    #alias grep='grep --color=auto'
    #alias fgrep='fgrep --color=auto'
    #alias egrep='egrep --color=auto'

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion

test -s ~/.alias && . ~/.alias || true
export PS1="\w>"
export LD_LIBRARY_PATH=/usr/local/cuda/lib
source /opt/intel/Compiler/11.1/064/bin/intel64/ifortvars_intel64.sh
source /opt/intel/Compiler/11.1/064/bin/intel64/idbvars.sh