How to connect through sftp to a non-standard port on Midnight Commander?

Whenever you want to use non-default settings for ssh, define an alias in ~/.ssh/config. This way you can call ssh myalias, or have some application call ssh myalias under the hood, without having to worry as to how you're going to pass settings such as a non-default port, a different user name and so on.

Host foo
HostName example.com
Port 2222
User yourusername

Then in Midnight Commander: cd #sh:foo:


I realised that I had already tried the solution, but it did not work because I did not have sshd listening on the VPN interface I was using. I have now got the internal interface listening on the standard port, so I do not even need this solution any more, but here it is:

cd #sh:[email protected]:[port]/home/username/

mc supports "Shell links" in the respective "side menu". This uses ssh to establish a fish connection (FIle transfer over SHell filesystem).

screenshot

mc help/man page:

help screenshot

AFAIK there is no equivalent to -J ssh option, when going through a jump server.

Tags:

Sftp

Mc