How to temporarily disable local forwards
There is ClearAllForwardings
option in ssh_config
, which does exactly what you need:
ClearAllForwardings
Specifies that all local, remote, and dynamic port forwardings specified in the configuration files or on the command line be cleared. This option is primarily useful when used from the ssh(1) command line to clear port forwardings set in configuration files, and is automatically set by scp(1) and sftp(1). The argument must be yes or no (the default).
You can use it as a commandline option:
ssh -o ClearAllForwardings=yes host