Windows DIR listing in TrueNAS vs Windows

JBK

Dabbler
Joined
Oct 30, 2021
Messages
46
Interesting problem ... (tested on multiple truenas units from the mini-x to Dell server homebuilt and from Windows server and Windows 10).

If you open a command prompt (Windows 10 in this case) and do a 'dir" command on a WINDOWS SMB mapped drive it appears that there is an implied "dir /on" switch on the command. Returned listing is showing files in order by name [a-z0-9] etc ...

If you open a command prompt (Windows 10 in this case) and do a 'dir" command on a TrueNAS SMB mapped drive then I have no idea what it is basing the listing on, but It DOES NOT match the listing from the Windows SMB share (exact copy of the directory).

This not only affects a simple command prompt but also any windows application that calls for a list of files in a directory/folder to build a table. I have been going through the SAMBA guide but cannot find anything.

Is there any option for SAMBA (global/share) that makes it show a listing by default in the "order by name" format when a standard "dir " is requested like a Windows share does?
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Have you tried setting a Windows system-wide environment variable?

1658188234420.png

1658188314294.png
 

JBK

Dabbler
Joined
Oct 30, 2021
Messages
46
I have not, very interesting. Will this system variable have an effect on windows dir listing functions made from inside a (c++) program? Let me test this ...

If it can be set on a GPO we might have a winner ... thank you.
 

JBK

Dabbler
Joined
Oct 30, 2021
Messages
46
@Samuel Tai This test (DIRCMD variable) actually worked, but it is not feasible to deploy in an enterprise with 600 workstations and people constantly moving around.

I found the variable vfs_dirsort — Sort directory contents in the Samba Guide, do you know if it is supported on TrueNAS implementation? It says it is global so where would it be placed? SMB service or share options? Thank you.

Code:
vfs objects = dirsort


 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Just add the DIRCMD env variable to the domain login scripts. That's what we do where I work.

TrueNAS may not bundle that VFS object. If it's not in /usr/local/lib/shared-modules/vfs/, then it's not available to be added to the SMB service's Auxiliary parameters.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
@Samuel Tai This test (DIRCMD variable) actually worked, but it is not feasible to deploy in an enterprise with 600 workstations and people constantly moving around.

I found the variable vfs_dirsort — Sort directory contents in the Samba Guide, do you know if it is supported on TrueNAS implementation? It says it is global so where would it be placed? SMB service or share options? Thank you.

Code:
vfs objects = dirsort


Dirsort is not supported. Some users have reported crashes while using it. Tickets with auxiliary parameters enabled where it looks like the parameter is likely a culprit are usually either rejected or reporter is asked to reproduce without auxiliary parameters. This is just informational.
 
Top