0

I have a remote (Debian 8) machine that I log into via SSH. In my every ssh session I need to initialize a variable "XDEBUG_CONFIG" so that later I can use debugging tools during the same session.

This is what I have to type in every one of my sessions:

export XDEBUG_CONFIG="remote_enable=1 remote_mode=req remote_port=9000 remote_host=10.0.2.2 remote_connect_back=0"

This variable is then used by other programs that I start within the same session.

I want to type less (or avoid typing at all, so that the variable XDEBUG_CONFIG is set automatically when I log in). The value is the same every time.

I tried putting the command into ~/.ssh/rc but it doesn't help. When I login again and

echo $XDEBUG_CONFIG

it shows an empty line. So far I have created and alias in my ~/.bashrc like this

alias helpdebug='echo "export XDEBUG_CONFIG=\"remote_enable=1 remote_mode=req remote_port=9000 remote_host=10.0.2.2 remote_connect_back=0\""'

and tried running this in backticks:

`helpdebug`

but this results in variable "XDEBUG_CONFIG" set to "remote_enable=1" only (i.e. up to the first space).

  • 1
    If it's fixed and not generated somehow, put it into ~/.bashrc – Jaroslav Kucera Sep 30 '17 at 7:42
2

Put this in your ~/.bashrc:

if [ -n "$SSH_CONNECTION" ]; then
    export XDEBUG_CONFIG="remote_enable=1 remote_mode=req remote_port=9000 remote_host=10.0.2.2 remote_connect_back=0"
fi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.