problem with environment detecting

Maxim Ryabenko maxy at rt.mipt.ru
Tue Mar 12 14:34:30 EST 2002


Hello!

I want  to detect some environment on a remote host (in C program, getenv()), 
but it is failed. Here is a little program which I try to run on a remote 
host with command:  "#ssh myhost myecho"

/* myecho */
#include <stdio.h>
main (){
        char *dir;
        if ((dir = getenv("MYDIR")) != NULL)
                printf ("environment is %s\n",dir);
        else
                printf ("enviroment is not specified.\n");
}

it returns "enviroment is not specified.", although the environment MYDIR is 
specified in /etc/profile on a remote host. 
In this way I can detect only $PATH, $USER, $HOSTNAME, but not MYDIR :(

On the other hand "./ssh myhost echo $MYDIR" works correctly

What is wrong?
Thank you!
Maxim



More information about the openssh-unix-dev mailing list