Find the answer to your Linux question:
Results 1 to 3 of 3
I have client1 and client2 both are linux machines. From client1: client1$ssh root@client2 "env" it displays list of ssh variables from client2. Things I did on client2: ================= I want ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,769

    Thumbs up ssh - export a variable


    I have client1 and client2 both are linux machines.
    From client1:
    client1$ssh root@client2 "env"
    it displays list of ssh variables from client2.

    Things I did on client2:
    =================
    I want to add new variable to client2 . So I edited sshd_config to
    PermitUserEnvironment yes

    and created a file environment under ssh with following entry
    Hi=Hello

    then restart sshd
    /etc/init.d/sshd

    ---------
    Now from client1 trying the same command
    client1$ssh root@client2 "env"

    didn't provide the new variable "Hi".

    Ref:
    Christian thoughts in a tech world: Forcing environment in SSH
    Netexpertise Environment Variables and SSH
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  2. #2
    Just Joined! DT0X's Avatar
    Join Date
    Nov 2008
    Location
    Southwest UK
    Posts
    31
    and created a file environment under ssh with following entry
    Hi=Hello
    Where did you create this entry? In roots profile?

  3. #3
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,769

    Exclamation

    Quote Originally Posted by DT0X View Post
    Where did you create this entry? In roots profile?
    Thanks, few minutes back I fixed this issue. You are correct DTOX, its problem with location environment file , It should be under ~/.ssh not under /etc/ssh.
    So after moving environment file from /etc/ssh to ~/.ssh it started working
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •