Skip to content

Saving an FTP Password in Midnight Commander

TL;DR ✨

Midnight Commander can store an FTP connection in its directory hotlist. A password can be added directly to the hotlist file, but it remains there as plain text. For normal use, SFTP with SSH key authentication is the safer option.

From the archive

This procedure was originally published on January 31, 2015. It describes a legacy solution for situations where FTP must be used. Prefer SFTP whenever the server supports it.

The password remains readable

The ~/.config/mc/hotlist file stores the password as plain text. Any user or process that can read the file can also read the password. FTP itself does not encrypt credentials or transferred data either.

Saving the Connection in the Hotlist

  1. In Midnight Commander, press ++f9++, open the Right menu, and select FTP link.
  2. Enter the address in the form user@server, for example demo@example.net, and press ++enter++.
  3. Enter the password when prompted.
  4. Press ++f9++ again and select Directory hotlist from the Command menu.
  5. Select Add current and confirm the dialog.
  6. Exit Midnight Commander and open ~/.config/mc/hotlist.

The saved connection looks approximately like this:

ENTRY "/ftp://demo@example.net/" URL "/ftp://demo@example.net/"

Adding the Password

Add the password only to the address following the URL attribute. The general form is:

ENTRY "/ftp://USER@SERVER/" URL "/ftp://USER:PASSWORD@SERVER/"

An example using deliberately fictional credentials:

ENTRY "/ftp://demo@example.net/" URL "/ftp://demo:CHANGE_ME@example.net/"

After saving the file, the connection can be selected from the directory hotlist without entering the password again.

A Safer Alternative

If the server is under your control, use SFTP instead. The transfer then runs over SSH, and authentication can use a key rather than a password embedded in a configuration file.