Midnight Commander with SMB support

  • 46th day of Chaos, in the yold 3183
  • 2 Comments

The popular console file manager mc is capable of handling Windows network resources (smb share) in the same way as it handles ftp/sftp. However, this feature is disabled by default. This article will describe how to add samba support to mc.

For this we need to rebuild the mc package. On Ubuntu/Debian (and later Ubuntu/Debian based operating systems) we will need to pre-install the required dependencies:

sudo apt-get build-dep mc

In Redhat (Fedora, Centos):

sudo dnf builddep mc

Next, you can download the mc source code from the official website, from some third-party sources, or you can clone it from the main github repository:

git clone https://github.com/MidnightCommander/mc

In that case, samba-enabled configuration, compilation and installation can be done with commands:

cd mc
./autogen.sh
./configure --enable-vfs-smb
make
sudo make install

Done.

In Debian (and Ubuntu, Linux Mint, etc.), if you have src-repositories connected, you can build the installation deb packages:

mkdir mc_smb
cd mc_smb
apt-get source mc

Then use any text editor to open the rules file in the mc_smb/mc-4.x.xx/debian folder (where 4.x.xx is the downloaded version number) and lines:

--enable-tests
# --enable-vfs-smb=yes

change to:

--enable-tests \
--enable-vfs-smb=yes

You can then go to the source directory and build the new packages:

cd mc-4.x.xx
dpkg-buildpackage

After a while the packages will be assembled and be found in the directory above, it can be reinstalled with the command:

cd ..
sudo dpkg -i mc-data_4.x.xx_all.deb mc_4.x.xx_arch.deb

(where 4.x.xx is the build version number and arch is your CPU architecture)
Of course, you could also install the compiled mc package with your usual installer instead.

Addendum:

You can also download the patches and packages of a specific version of mc: https://github.com/zlaxy/mc.
It, unlike the official branch:
– there is a scrollbar in the active panels;
– pressing F3 on a directory counts and displays its size;
– Shift+F1/Shisft+F2 or F11/F12 open the menu of mountpounts with the hotlist (with ability to add network and smb addresses to it);

Here’s what it looks like:

  1. аыа says:

    статье сто лет, apt-get source mc уже давно не выполняется, тк. нет исходников уже этих

    • info says:

      Дополнил статью с описанием сборки из исходников официального github. Ко всем пакетам с открытым исходным кодом в Debian/Ubuntu прилагаются пакеты с исходниками, просто они не включены по-умолчанию. Надо добавить строку deb-src аналогичную deb в /etc/apt/sources.list.

      В Ubuntu можно просто поставить галочку напротив Source code здесь:

Leave a Comment

Your email address will not be published. Required fields are marked *