Koozali.org: home of the SME Server

enable recycle bin on home directories ?

Offline john56

  • ***
  • 143
  • +0/-0
enable recycle bin on home directories ?
« on: February 27, 2019, 07:02:09 PM »
Hi,
is it possible to do it with home folders ?
Today, someone has lost 3 hours of work by delete his file .... i don't know how to get it back, but maye it's possible to avoid it for the futur ?
Many thanks.

Offline Jean-Philippe Pialasse

  • *
  • 2,763
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: enable recycle bin on home directories ?
« Reply #1 on: February 27, 2019, 11:03:32 PM »
Sure,

Searching recycle bin on wiki:

https://wiki.contribs.org/RecycleBin#Enable_Recycle_Bin_for_users

Any backup?


Offline john56

  • ***
  • 143
  • +0/-0
Re: enable recycle bin on home directories ?
« Reply #2 on: February 28, 2019, 08:40:38 AM »
Of course i have a backup (i have a good teacher whose name is JPP :lol:) but my backup is the night, not along the day. (She wrote her file during the day)
I knew there was a recycle bin for "shared_folder" but not for ibays and /homes. It's a good new. I used your link to activate recycle bin for my users and i have done it for my shared folder too (with the contrib's options).
It seems to work.
But, is there a way (as for ibays way) to rename recycle bin for users and shared folders and to hide it.
Thanks.
« Last Edit: February 28, 2019, 08:45:56 AM by john56 »

Offline Jean-Philippe Pialasse

  • *
  • 2,763
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: enable recycle bin on home directories ?
« Reply #3 on: February 28, 2019, 01:40:36 PM »



Edit: RTFM! ;)
Well in fact just keep reading the same page i pointed out.

https://wiki.contribs.org/RecycleBin#Changing_the_Recycle_Bin_name


If you want it integrated, please do so by opening a bug against sme 10 to get it included. Yes sme 10 as only security patch are welcomed for sme9 now. Time to move on.
« Last Edit: February 28, 2019, 01:58:51 PM by Jean-Philippe Pialasse »

Offline Jean-Philippe Pialasse

  • *
  • 2,763
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: enable recycle bin on home directories ?
« Reply #4 on: February 28, 2019, 01:42:20 PM »
By the way some limitations with samba recycle bins. It only work if you actually erase the file. Not if you alter it.

Offline mmccarn

  • *
  • 2,627
  • +10/-0
Re: enable recycle bin on home directories ?
« Reply #5 on: February 28, 2019, 01:47:17 PM »
This worked for me to make "Recycle Bin" a hidden folder:

Code: [Select]
/etc/e-smith/templates/etc/smb.conf
mkdir -p "$(pwd |sed 's/templates/templates-custom/')"
sed 's/"Recycle Bin"/".Recycle Bin"/' 10recyclebin > "$(pwd |sed 's/templates/templates-custom/')/10recyclebin"
expand-template /etc/samba/smb.conf
/etc/rc7.d/S91smb restart

Here is a less cryptic version:
Code: [Select]
mkdir -p /etc/e-smith/templates-custom/etc/smb.conf
cp /etc/e-smith/templates/etc/smb.conf/10recyclebin /etc/e-smith/templates-custom/etc/smb.conf
cd /etc/e-smith/templates-custom/etc/smb.conf
sed -i 's/"Recycle Bin"/".Recycle Bin"/' 10recyclebin
expand-template /etc/samba/smb.conf
/etc/rc7.d/S91smb restart

To UNDO these changes:
Code: [Select]
'rm' -f /etc/e-smith/templates-custom/etc/smb.conf/10recyclebin
expand-template /etc/samba/smb.conf
/etc/rc7.d/S91smb restart

[edit]
Add missing "cd /etc/e-smith/templates-custom/etc/smb.conf" to second code example
« Last Edit: March 02, 2019, 01:26:50 PM by mmccarn »

Offline john56

  • ***
  • 143
  • +0/-0
Re: enable recycle bin on home directories ?
« Reply #6 on: February 28, 2019, 07:29:19 PM »
Thanks for your answers.
I don't use ibays but shares folder contrib.  I will try to adapt it with those scripts, but i am always affraid to make a mistake by playing with the commands.

Offline Jean-Philippe Pialasse

  • *
  • 2,763
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: enable recycle bin on home directories ?
« Reply #7 on: March 01, 2019, 04:27:54 AM »
First try on your test server on a vm, as always.

It is there to be broken anyway !

Offline john56

  • ***
  • 143
  • +0/-0
Re: enable recycle bin on home directories ?
« Reply #8 on: March 01, 2019, 07:55:38 AM »
Hi @mmccarn,
it doesn't work for me for home's users and shares folder (no ibay for me).
No error with your command lines.

Offline Jean-Philippe Pialasse

  • *
  • 2,763
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: enable recycle bin on home directories ?
« Reply #9 on: March 01, 2019, 12:29:32 PM »
Hi @mmccarn,
it doesn't work for me for home's users and shares folder (no ibay for me).
No error with your command lines.

Sed line on second non cryptic version is missing the full path of the file. So either you need to move to the newly created template custom folder either you need to write full path of file


Offline john56

  • ***
  • 143
  • +0/-0
Re: enable recycle bin on home directories ?
« Reply #10 on: March 01, 2019, 04:00:36 PM »
That is ok for user's home by adding a dot .Recycle Bin.
For the share folders it seems i have to adapt /etc/e-smith/templates/etc/smb.conf/shares/recyclebin

Offline mmccarn

  • *
  • 2,627
  • +10/-0
Re: enable recycle bin on home directories ?
« Reply #11 on: March 02, 2019, 01:27:57 PM »
Sed line on second non cryptic version is missing the full path of the file. So either you need to move to the newly created template custom folder either you need to write full path of file

Doh.  Missing "cd /etc/e-smith/templates-custom/etc/smb.conf" added to the original post...