environment/.profile problems? - SSH

This is a discussion on environment/.profile problems? - SSH ; Hi, I'm fairly new to ssh and I have what is hopefully a rookie question. - I manage two servers, serverA and serverB - I log in to a shell on serverA then run -> ssh serverB brings me to ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: environment/.profile problems?

  1. environment/.profile problems?

    Hi,

    I'm fairly new to ssh and I have what is hopefully a rookie question.

    - I manage two servers, serverA and serverB
    - I log in to a shell on serverA then run -> ssh serverB <-, this
    brings me to a shell on serverB.
    - On serverB I run the following command:
    set | wc -l
    and get 56 lines (that means 56 environment variables are set)
    - I log out out of serverB and I'm back on serverA.
    - On serverA I run the following command:
    ssh "set | wc -l"
    and get 28 lines (that means 28 environment variables are set)

    It appears that something is different about the environment, and this
    is breaking a lot of other things.

    Why would these two not match?

    Is ssh not running my .profile when I use it to execute commands on
    serverB?

    Below are two debug traces that might help.

    Thanks in advance,

    ed

    -----------------------------------------------------------------------
    $ ssh -v alnvitalagg1
    Sun_SSH_1.1, SSH protocols 1.5/2.0, OpenSSL 0x0090700f
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Applying options for *
    debug1: Rhosts Authentication disabled, originating port will not be
    trusted.
    debug1: ssh_connect: needpriv 0
    debug1: Connecting to alnvitalagg1 [10.36.22.168] port 22.
    debug1: Connection established.
    debug1: identity file /usr/home/vsadm/.ssh/identity type -1
    debug1: identity file /usr/home/vsadm/.ssh/id_rsa type 1
    debug1: identity file /usr/home/vsadm/.ssh/id_dsa type -1
    debug1: Remote protocol version 2.0, remote software version
    Sun_SSH_1.1
    debug1: no match: Sun_SSH_1.1
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-Sun_SSH_1.1
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: server->client aes128-cbc hmac-md5 none
    debug1: kex: client->server aes128-cbc hmac-md5 none
    debug1: Peer sent proposed langtags, ctos: en-US,hi-IN,en-CA,es,es-
    MX,fr,fr-CA,i-default
    debug1: Peer sent proposed langtags, stoc: en-US,hi-IN,en-CA,es,es-
    MX,fr,fr-CA,i-default
    debug1: We proposed langtags, ctos: en-US
    debug1: We proposed langtags, stoc: en-US
    debug1: Negotiated lang: en-US
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
    debug1: Remote: Negotiated main locale: en_US.UTF-8
    debug1: Remote: Negotiated messages locale: en_US.UTF-8
    debug1: dh_gen_key: priv key bits set: 108/256
    debug1: bits set: 1530/3191
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
    debug1: Host 'alnvitalagg1' is known and matches the RSA host key.
    debug1: Found key in /usr/home/vsadm/.ssh/known_hosts:19
    debug1: bits set: 1594/3191
    debug1: ssh_rsa_verify: signature correct
    debug1: newkeys: mode 1
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: newkeys: mode 0
    debug1: SSH2_MSG_NEWKEYS received
    debug1: done: ssh_kex2.
    debug1: send SSH2_MSG_SERVICE_REQUEST
    debug1: got SSH2_MSG_SERVICE_ACCEPT
    debug1: Authentications that can continue: gssapi-keyex,gssapi-with-
    mic,publickey,password,keyboard-interactive
    debug1: Next authentication method: publickey
    debug1: Trying private key: /usr/home/vsadm/.ssh/identity
    debug1: Trying public key: /usr/home/vsadm/.ssh/id_rsa
    debug1: Server accepts key: pkalg ssh-rsa blen 149 lastkey 113ed8 hint
    1
    debug1: read PEM private key done: type RSA
    debug1: Authentication succeeded (publickey)
    debug1: channel 0: new [client-session]
    debug1: send channel open 0
    debug1: Entering interactive session.
    debug1: ssh_session2_setup: id 0
    debug1: channel request 0: env
    debug1: channel request 0: pty-req
    Warning: No xauth data; using fake authentication data for X11
    forwarding.
    debug1: Requesting X11 forwarding with authentication spoofing.
    debug1: channel request 0: x11-req
    debug1: channel request 0: shell
    debug1: fd 4 setting TCP_NODELAY
    debug1: channel 0: open confirm rwindow 0 rmax 32768
    debug1: Remote: Channel 0 set: LANG=en_US
    Last login: Wed Jun 27 10:54:59 2007 from alnvitalmst1.wn
    Sun Microsystems Inc. SunOS 5.9 Generic May 2002
    You have new mail.
    [vsadm@alnvitalagg1: /usr/home/vsadm ]
    $ set | wc -l
    56
    [vsadm@alnvitalagg1: /usr/home/vsadm ]
    $ ^D
    debug1: channel 0: rcvd eof
    debug1: channel 0: output open -> drain
    debug1: channel 0: obuf empty
    debug1: channel 0: close_write
    debug1: channel 0: output drain -> closed
    debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
    debug1: channel 0: rcvd close
    debug1: channel 0: close_read
    debug1: channel 0: input open -> closed
    debug1: channel 0: almost dead
    debug1: channel 0: gc: notify user
    debug1: channel 0: gc: user detached
    debug1: channel 0: send close
    debug1: channel 0: is dead
    debug1: channel 0: garbage collecting
    debug1: channel_free: channel 0: client-session, nchannels 1
    Connection to alnvitalagg1 closed.
    debug1: Transferred: stdin 0, stdout 0, stderr 36 bytes in 19.0
    seconds
    debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 1.9
    debug1: Exit status 0
    [vsadm@alnvitalmst1: /usr/home/vsadm ]
    $ ^C
    [vsadm@alnvitalmst1: /usr/home/vsadm ]
    $
    -----------------------------------------------------------------------

    $ ssh -v vsadm@alnvitalagg1 "set | wc -l"
    Sun_SSH_1.1, SSH protocols 1.5/2.0, OpenSSL 0x0090700f
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Applying options for *
    debug1: Rhosts Authentication disabled, originating port will not be
    trusted.
    debug1: ssh_connect: needpriv 0
    debug1: Connecting to alnvitalagg1 [10.36.22.168] port 22.
    debug1: Connection established.
    debug1: identity file /usr/home/vsadm/.ssh/identity type -1
    debug1: identity file /usr/home/vsadm/.ssh/id_rsa type 1
    debug1: identity file /usr/home/vsadm/.ssh/id_dsa type -1
    debug1: Remote protocol version 2.0, remote software version
    Sun_SSH_1.1
    debug1: no match: Sun_SSH_1.1
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-Sun_SSH_1.1
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: server->client aes128-cbc hmac-md5 none
    debug1: kex: client->server aes128-cbc hmac-md5 none
    debug1: Peer sent proposed langtags, ctos: en-US,hi-IN,en-CA,es,es-
    MX,fr,fr-CA,i-default
    debug1: Peer sent proposed langtags, stoc: en-US,hi-IN,en-CA,es,es-
    MX,fr,fr-CA,i-default
    debug1: We proposed langtags, ctos: en-US
    debug1: We proposed langtags, stoc: en-US
    debug1: Negotiated lang: en-US
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
    debug1: Remote: Negotiated main locale: en_US.UTF-8
    debug1: Remote: Negotiated messages locale: en_US.UTF-8
    debug1: dh_gen_key: priv key bits set: 138/256
    debug1: bits set: 1614/3191
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
    debug1: Host 'alnvitalagg1' is known and matches the RSA host key.
    debug1: Found key in /usr/home/vsadm/.ssh/known_hosts:19
    debug1: bits set: 1649/3191
    debug1: ssh_rsa_verify: signature correct
    debug1: newkeys: mode 1
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: newkeys: mode 0
    debug1: SSH2_MSG_NEWKEYS received
    debug1: done: ssh_kex2.
    debug1: send SSH2_MSG_SERVICE_REQUEST
    debug1: got SSH2_MSG_SERVICE_ACCEPT
    debug1: Authentications that can continue: gssapi-keyex,gssapi-with-
    mic,publickey,password,keyboard-interactive
    debug1: Next authentication method: publickey
    debug1: Trying private key: /usr/home/vsadm/.ssh/identity
    debug1: Trying public key: /usr/home/vsadm/.ssh/id_rsa
    debug1: Server accepts key: pkalg ssh-rsa blen 149 lastkey 113ed8 hint
    1
    debug1: read PEM private key done: type RSA
    debug1: Authentication succeeded (publickey)
    debug1: channel 0: new [client-session]
    debug1: send channel open 0
    debug1: Entering interactive session.
    debug1: ssh_session2_setup: id 0
    debug1: channel request 0: env
    Warning: No xauth data; using fake authentication data for X11
    forwarding.
    debug1: Requesting X11 forwarding with authentication spoofing.
    debug1: channel request 0: x11-req
    debug1: Sending command: set | wc -l
    debug1: channel request 0: exec
    debug1: fd 4 setting TCP_NODELAY
    debug1: channel 0: open confirm rwindow 0 rmax 32768
    debug1: Remote: Channel 0 set: LANG=en_US
    28
    debug1: channel 0: rcvd eof
    debug1: channel 0: output open -> drain
    debug1: channel 0: obuf empty
    debug1: channel 0: close_write
    debug1: channel 0: output drain -> closed
    debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
    debug1: channel 0: rcvd close
    debug1: channel 0: close_read
    debug1: channel 0: input open -> closed
    debug1: channel 0: almost dead
    debug1: channel 0: gc: notify user
    debug1: channel 0: gc: user detached
    debug1: channel 0: send close
    debug1: channel 0: is dead
    debug1: channel 0: garbage collecting
    debug1: channel_free: channel 0: client-session, nchannels 1
    debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.1 seconds
    debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
    debug1: Exit status 0
    [vsadm@alnvitalmst1: /usr/home/vsadm ]
    $


  2. Re: environment/.profile problems?

    On 2007-06-27, efair wrote:

    > - I manage two servers, serverA and serverB


    There's your problem. Half the questions here come from people
    using serverA and serverB as the hostnames.

    > Is ssh not running my .profile when I use it to execute commands on
    > serverB?


    You may find .bashrc is used with remote commands but .bash_profile isn't
    because you don't get a login shell (and other similar findings according
    to what your shell is).

    --
    Elvis Notargiacomo master AT barefaced DOT cheek
    http://www.notatla.org.uk/goen/

+ Reply to Thread