Nethserver and File Server

NethServer Version: 7.7.1908
Module: Active Directory File Server

Hello everyone,

my work to integrate NS with my services continue.
I’m trying to integrate the AD authentication on Openmediavault using NS as AD.
Unfortunately it’s bit a pain, since the samba version that OMV is using.

I was thinking to migrate the file server on a second instance of NS.
I tried and the integration is perfect, I can join the domain and use the users to setup the file server.

There are a couple of things I didn’t find out:

  • Recycle Bin autodelete policy: Is it possible to delete the recycle bin after N days? ( I can also managed by a script, but it will be useful have it from the GUI ).

  • Is it possible change the recycle bin name? Since the first letter is an R, it will be mix up with my document. Using something like “#Recycle Bin” should address it, since the folder will be on the top. I might change it in smb.conf, but probably it will be overwritten.

  • I didn’t see any Recycle bin for user home directory.

Any suggestion pls?

Thanks
Emiliano

1 Like

Nope, as far as I know the name is hard-coded.
I could think of different options:

If second option is plausible, I think it would be easier and safer (regarding updates) than option 1.


It was requested long ago but, if I’m not mistaken, it was not implemented. A cron job or scripted option could be something like:


…or

SomeOne script

https://lonewolfonline.net/enabling-recycle-bin-functionality-samba/
SomeOne
7th August 2012 at 12:00 am
Script for automatic trash dir cleanup:

#!/bin/bash

# cleanup recycle dir:
# delete all files with last access time
# older than a specific number of days and
# remove all empty subdirs afterwards.
#
# make sure you set recycle:touch = yes
# in your smb.conf.

# set vars
recycle_dir='/mystorage/recycle/your_recycle_dir_name'
lastaccess_maxdays=30

# execute commands
find $recycle_dir -atime +$lastaccess_maxdays -type f -delete
find $recycle_dir -type d ! -path $recycle_dir -empty -delete

I cannot tell (don’t know).

1 Like

Hello Marc,

thank you for you reply.
While we can manage the policy with a script, recycle bin for home user should be implemented.
Is there any way I can manually add it in the config without it will be overwritten?

I saw you use templates which are integrated in the smb.conf, but I don’t if I can edit the template manually, probably they’ll be overwritten with some updates, isn’t it?

Do you have any suggestion to integrate NS AD with samba 4.9.x?
I’m fighting with the new version of OpenMediaVault 5 ( Debian 10 ) which is using samba 4.9.5.
AFAIK starting from version 4.8 something changed with the winbind so the config needs to be changed.
I saw NS is using samba 4.9.1 and I tried to take a look on this files:

nssswitch.conf, sssd.conf, smb.conf and krb5.conf, but I’m still having trouble with the authentication and user mapping.

I cannot post further details right now, but I’ll if someone can give some tips.

Thanks

It would also be great if NS File Server could add AFP support
OMV has it, and I can be integrated with samba for user/group permission and also ACL.

Finally managed to integrate NS with openmediavault following the documentation arch linux.
https://wiki.archlinux.org/index.php/Active_Directory_integration
Only winbind!

I’m still trying nethserver as file server ( I already have OMV 5 in place ), but it miss some features.

Can I have an example of custom template to replace only a key?

I successfully replaced the whole file, but I’d like to second option as @dnutan suggest.

Thanks!

If users don’t use the option to see hidden files and folders, from Windows you can set each Recycle Bin as hidden.

Something like this shall work.
mkdir -p /etc/e-smith/templates-custom/etc/samba/smb.conf/ibay-default/
vi /etc/e-smith/templates-custom/etc/samba/smb.conf/ibay-default/01vfs_recycle_custom
{
    #
    # 01vfs_recycle_custom
    #

    # if repository is not set, default path .recycle is used
    delete($ibay_vfs->{recycle}->{repository});
    # or to set a specific name
    # $ibay_vfs->{recycle}->{repository} = "#Recycle Bin";

    '';
}
signal-event nethserver-samba-update

…at least while original template does not change drastically.


It is not set.

Yes, do not edit original templates as they could be overwritten by updates. Instead, create a template-custom (see docs).

Here's an indicative example.
mkdir -p /etc/e-smith/templates-custom/etc/samba/smb.conf/
vi /etc/e-smith/templates-custom/etc/samba/smb.conf/99custom

The 99custom file content is hard-coded (not dynamically generated):

#
# 99custom
#

[homes]
# User Recycle Bin (tweak options/permissions at will)
vfs objects = recycle
  recycle: exclude_dir = /tmp,/temp,/cache
  recycle: versions = True
  recycle: keeptree = True
  recycle: touch = True
  recycle: directory_mode = 0770
  recycle: exclude = *.tmp,*.temp,*.o,*.obj,~$*


[global]

…hoping smb.conf sees content from repeated sections.

Note: I was trying default and custom recycle bins and seems they don’t keep all deleted files and tree structure. Anyone can confirm it (no customization required)?

1 Like