File Managers

UPDATED: Samba Permissions and HiFile

We recently reviewed HiFile, a no-charge, proprietary, cross-platform, Qt-based orthodox file manager. In our review, we commended the program. It’s a very slick file manager offering some advantages (and a few disadvantages) when compared to its closest rival, the open source Krusader.

We’ve received many queries in our mailbox about HiFile and problems with openings PDFs. So we thought we’d share our findings publicly.


The Issue

If we double-click on a PDF file in HiFile that’s stored on an SMB share, HiFile tries to run the file and fails.

Let’s look at the permissions of PDFs stored on the SMB share.

Permissions

As you can see, the PDF files have the executable bit set. If we try to make the PDF non-executable in HiFile, this action fails.

Permissions


Why does this issue arise?

Samba was invented to share files with systems that had no permissions beyond read-only/read-write. By default, Samba does not transmit UNIX permissions. Depending on the configuration, either all files are marked executable or all files (except directories) are marked non-executable. In most users’ setups, all files on a Samba share are marked executable.

When we double left click on a PDF HiFile attempts to run the file. What the double click should do is open the file with the default PDF program (in our case that’s Document Viewer). Krusader opens PDFs in this way with no issue. So the issue is either a configuration anomaly with Samba, and/or a bug on HiFile.


Things we tried

1. Edit /etc/fstab on the local machine and add file_mode=0644 to the relevant fstab line e.g

//192.168.1.201 /mnt/i3-share3 cifs credentials=/home/sde/.smbcredentials,uid=sde,gid=sde,file_mode=0644 0 0

The 0644 means that:

  • The file’s owner can read and write (6).
  • Users in the same group as the file’s owner can read (first 4).
  • All users can read (second 4).

Did this fix the issue? Yes

The files when viewed in HiFile no longer show the files are executable. A double click on the PDF file opens the file in Document Viewer. However, PDF files (and all other files ) still show as executable on the server.


2. Remove the execute permission for PDF files. We can use the chmod command. For example:

$ chmod u-x *.pdf

Did this fix the issue? No.

While the server shows the execute permission has been removed, HiFile still shows the files as having the execute permission, and fails to open PDFs with a double mouse click.


3. As we have write permission for the Samba configuration file /etc/samba/smb.conf file, we tried adding the following entry to the [global] section:

unix extensions = yes

Did this fix the issue? No


4. Another suggestion we’ve received is to again edit /etc/samba/smb.conf file and add the lines below to the [global] or the the specific [share] section:

map archive = no
map system = no
map hidden = no
force create mode = 0660

Did this fix the issue? No


5. Use NFS instead of Samba.

Did this fix the issue? Yes

However, using NFS is unlikely to be a practical option in many situations.


The Solution

Actually the solution is quite simple. All we need to do is use the noexec option in fstab. For example:

//192.168.1.206/hp /mnt/i3-share2 cifs credentials=/home/sde/.smbcredentials,uid=sde,gid=sde,noexec 0 0
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Rock
Rock
9 months ago

Hi, HiFile is a very attractive clone of Double Commander that works well on MacOS and Windows. On all Linux instances I have (Debian, Manjaro, Solus and Open SUSE) HiFile crashes on file copy operations unless the files are copied one at a time.