.bashrc at ssh login

后端 未结 4 1539
悲&欢浪女
悲&欢浪女 2020-11-29 15:07

When I ssh into my ubuntu-box running Hardy 8.04, the environment variables in my .bashrc are not set.

If I do a source .bashrc, the variab

4条回答
  •  猫巷女王i
    2020-11-29 15:24

    I had similar situation like Hobhouse. I wanted to use command

     ssh myhost.com 'some_command'
    

    and 'some_command' exists in '/var/some_location' so I tried to append '/var/some_location' in PATH environment by editing '$HOME/.bashrc'

    but that wasn't working. because default .bashrc(Ubuntu 10.4 LTS) prevent from sourcing by code like below

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

    so If you want to change environment for ssh non-login shell. you should add code above that line.

提交回复
热议问题