openfile and samba trash support
23 Sep 2013
Sometimes it can useful to have trash support in samba/cifs. Sadly it’s not straighforward to do in openfiler.
/opt/openfiler/var/www/includes/generate.inc
In an average samba installation preferences are saved in /etc/samba/smb.conf, in openfiler however this and many other files are constantely rebuild, so this changes won’t last if you apply them there. Modify /opt/openfiler/var/www/includes/generate.inc instead:
1588 line:
/* enable trash support */ $ac_smb_fp->AddLine( "\n"); $ac_smb_fp->AddLine( " ; enable trash support"); $ac_smb_fp->AddLine( " vfs objects = audit recycle" ); $ac_smb_fp->AddLine( " recycle: repository = /path/.trash" ); $ac_smb_fp->AddLine( " recycle: keeptree = Yes" ); $ac_smb_fp->AddLine( " recycle: exclude = *.tmp, *.temp, *.log, *.ldb" ); $ac_smb_fp->AddLine( " recycle: exclude_dir = tmp " ); $ac_smb_fp->AddLine( " recycle: versions = Yes " ); $ac_smb_fp->AddLine( " recycle: noversions = *.docx|*.doc|*.xls|*xlsx|*.ppt|*.odt" ); $ac_smb_fp->AddLine( "\n");
It may be a good idea to delete oldest files every now and then:
0 6 * * * root find /path/.trash -type f -mtime +14 -delete > /dev/null
Happy trashing 😉