Can I forward env variables over ssh?

后端 未结 3 701
执笔经年
执笔经年 2020-12-01 07:15

I work with several different servers, and it would be useful to be able to set some environment variables such that they are active on all of them when I SSH in. The proble

3条回答
  •  天命终不由人
    2020-12-01 07:59

    Something like:

    ssh user@host bash -c "set -e; $(env); . thescript.sh"

    ...might work (untested)

    Bit of a hack but if you cannot change the server config for some reason it might work.

提交回复
热议问题