I manage SSH connections to remote machines using a special ProxyCommand in my ssh_config file. Suffice to say it's structured like this:
Host my-target
IdentityFile /path/to/temporary-key
ProxyCommand /path/to/custom-script %n %r %p /path/to/temporary-key
As you can see, when I enter ssh me@my-target, SSH will read this file and execute the custom-script, passing it the hostname, user, (default) port, and a path to the private key it will attempt to use to authenticate to the server (which the custom script will generate in real time). This works just fine.
However, I would like for the custom-script to behave differently depending on whether it was invoked via ssh vs. scp. As far as I'm aware, there is no ssh_config token that stores this, but it seems like it should be possible in theory.
Is there a way to pass this information to my ProxyCommand?