I've been able to set this up in WinSCP and it works beautifully. I login as jj@remote-host and then, as per the Shell setting under Environment | SCP/Shell, it immediately does: sudo su - foouser and I'm able to transfer files as foouser. Awesome!
My question is, how does WinSCP achieve this? I'm trying to do the same thing from a shell, and I always get prompted with a password for foouser.
This is what I'm trying (just id at first, plan to figure out how to actually xfer files after I get that working):
ssh jj@remote-host 'sudo su - foouser -c "id"'
I'm thinking that since WinSCP can manage it, it's not an issue with permissions on remote-host but rather me not doing it right.