Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Midnight Commander one can make an SFTP connection to a remote machine using:

cd #sh:yourusername@example.com:/home/username/

How can this be done when the remote machine is using a non-standard port?

share|improve this question
up vote 3 down vote accepted

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:yourusername@example.com:[port]/home/username/
share|improve this answer

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
UserName yourusername

Then in Midnight Commander: cd #sh:foo:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.