It seems that this question needs some explanations.
Current I wrote a ssh wrapper bash function that is starting or restoring tmux sessions on the remote hosts.
It's presence is totally transparent to the user, you just type ssh host
and because function ssh() { ... }
is defined inside your .bash_profile
this will be executed instead of real ssh.
Now, I do have this problem, on a small percentage of hosts they do not have a real shell and they have a pseudo-shell that drops the ssh connection if it receives commands that it does not understand. Examples: NetScaler, Synology (uses ash
), CISCO routers, ...
What I want to do is to embed some login inside the ssh() wrapper so it will stop failing on these machines. Initially I made a blacklist but this shortly became too hard to manage, I need a proper fix.
ssh host.example.com
X11 forwarding request failed on channel 0
ash: darwin: unknown operand
ash: md5sum: not found
ash: syntax error: 0x
Connection to host.example.com closed.
>$ echo $?
0
How can I solve this problem from inside the bash function?