4

I've some rules in .ssh/config file which I would like activate only in interactive mode (ie. terminal background change). Is that possible?

2
  • Could you be more specific about what you are trying to achieve? I suggest that you include the relevant parts of the two config files. Sep 20, 2018 at 17:01
  • What's your definition of interactive? Do you mean whether a command has been passed to the ssh command or not? Or are you referring to the use of any of the flags -t, -T, -N?
    – kasperd
    Sep 20, 2018 at 17:09

1 Answer 1

3

You can alias ssh if using a non-interactive shell as follows in your ~/.bashrc file:

    if [ -z "$PS1" ]; then
        alias ssh='ssh -F ~/.ssh/config-non-interactive'
    fi

... then copy the non-interactive configuration you'd like to use to ~/.ssh/config-non-interactive and you should be set.

1
  • When this is combined with Include I think it will be a flexible way of utilising config files. superuser.com/a/1142813 . There were many times I gave up on certain config features because it wasn’t compatible across my workstations.
    – user311189
    Sep 20, 2018 at 14:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .