Save Connection Settings in Midnight Commander

In Midnight Commander when you press ctrl + \ you can access directory hotlist and you can quickly choose connection you want to establish.

The problem is – you cannot by default save passwords, so every time you select this connection you need to input it. Sure, it’s safe to do so, but if using them in your desktop and you’re the only user of it – you can expect a bit more pragmatic approach.

You can define your site’s password explicitly in the MC configuration file which, by default, resides in ~/.config/mc/hotlist.

Just edit this file and you’ll see entry similar to below:

ENTRY “/ftp://piotr@192.168.1.251/” URL “/ftp://piotr@192.168.1.251/”

The first quoted string is the name of the connection visible when you enter the Hotlist Directory. The second one is the full connection string which has the following form:

ftp://USER:PASSWORD@HOST:PORT/DIR 

You can adjust it to have more user-friendly visual name and to hold your password:

ENTRY “NAS Storage” URL “/ftp://piotr:YOURPASSWORD@192.168.1.251/”

Because you define your passwords in plain-text remember to set appropriate CHMOD.

Now after running MC, hitting ctrl + \ and selecting the location you won’t be prompted for password any more.

As an end word – if you have the ability of registering SSH keys on the remote server – it will be a better solution. It will provide tighter security (you’ll use secured channel for communication) as well as it won’t require you to neither type the password, nor to put it in the plain-text file.