In my ~/.ssh/config file I have the following option:
RemoteCommand /bin/sh -c 'tmux has-session && exec tmux attach || exec tmux'
This automatically starts tmux and connects to an existing session if possible when connecting via ssh.
This causes sshfs to fail to connect with the error
read: Connection reset by peer.
Is there a way to apply this options selectively only when connecting with ssh and not when attempting to mount a filesystem with sshfs?
Note that I still want to load the remainder of the options in that file for sshfs, since they are still relevant. Using
sshfs -F /dev/null is not an option.
I could of course create two separate configuration files for ssh and sshfs, but that would require a bunch of duplication that seems unecessary.