vfs/shell: add MC_SSH_COMMAND and MC_SSH environment variable support#5080
vfs/shell: add MC_SSH_COMMAND and MC_SSH environment variable support#5080melnikovsky wants to merge 1 commit intoMidnightCommander:masterfrom
Conversation
MC_SSH_COMMAND, if set, is invoked via 'sh -c' so that it can contain options and arguments. MC's generated flags (compression, port, login name, hostname, remote command) are passed as positional parameters and are available as "$@" inside the command string, mirroring the GIT_SSH_COMMAND convention. MC_SSH, if set, replaces the 'ssh' binary with a plain executable path and no shell interpretation, analogous to GIT_SSH. MC_SSH_COMMAND takes precedence over MC_SSH. Examples: MC_SSH_COMMAND='ssh -i ~/.ssh/mykey' mc MC_SSH_COMMAND='ssh -o ProxyJump=bastion -o StrictHostKeyChecking=no' mc MC_SSH=/usr/local/bin/myssh mc Both variables are ignored for rsh connections (port == SHELL_FLAG_RSH).
|
I don't quite see how it properly fixes #2256: My understanding is that the pipe to Why try to solve this problem by introducing support for an external |
|
Admittedly, this PR does not fix #2256 but kind of resolves it. A proper fix would require going deeper in the Instead of implementing reopen (how many attempts?) and proper cleanup afterward - which is arguably even more important, since currently one has to restart Speaking of "other advantages", this approach could potentially allow unifying |
|
Alright, thanks for the explanation. I understand now why you submitted this PR, but hopefully you can also see the problem I have with it as a maintainer. I can take it in to introduce a new (so far undocumented) way to swap out the default ssh command. Without documentation, it will be undiscoverable. With documentation, less so, but nevertheless, it will have to be discovered and configured by every user who wishes to have it. On top of that, you'd have to have an external tool (autossh) installed and working. All in all, terrible user experience for some new code pathways and extra documentation. At the same time, one could just put the following in the This is how I solve the problem for me at the moment. Also, I think a minimal halfway proper implementation is rather simple. All you have to do is to check if the pipe is alive in the VFS command thing, and if not, close VFS with an error. That's it. The user will be able to reconnect manually afterwards without having to restart mc. If you want to make it nicer, then you can try to re-open the pipe at this point once, and if it doesn't work, then see above. I think this will be perfect in terms of user experience, will work out of the box for everyone without any external tools, and should not be that hard to implement. I wish you could look into that as an alternative to your current solution. |
Probably I am missing something important. My I would not bother fixing anything if I were able to simply reconnect! |
Well, it doesn't for me. It might die for you though. Why not? Consider genuine connection loss after
You can't. That's a bug. It seems that you have misinterpreted my statement. What I was saying is that fixing this bug so that you are able to reconnect (or even try to reconnect once automatically) is not too hard, instead of adding a workaround of questionable usability. |
Add support for
MC_SSH_COMMANDandMC_SSHenvironment variables (analogous toGIT_SSHandGIT_SSH_COMMAND). Enables custom wrapper usage, particularly autosshExample:
MC_SSH_COMMAND='autossh -M0 $@' mcResolves: shell link via ssh fails to restore after connection lost #2256