DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-04-15 00:02:10

kad
New member
Registered: 2008-04-14
Posts: 2

Recycle bin on 1.04 firmware : working, but not completely

Hi everybody,

with samba 3.xx on 1.04 Firmware, I tried to have a "recyle bin" on the DNS 323.

To perform this I followed the wiki on "better samba" when it comes to editing your own smb.conf. Here is what I added at the end of smb.conf :
vfs objects = recycle
recycle:repository = /mnt/HD_a2/Recycled
recycle:keeptree = No
recycle:touch = No
recycle:versions= No
recycle:maxsize = 0
recycle:exclude = *.tmp|*.temp|~$*|*.~??
recycle:excludedir = /mnt/HD_a2/Recycled/

Everything is working fin except the exclude option. It is a pity because soon enough the Recycled folder gets stuffed with temporary files (form MS Word, etc.)
The good thing is that I am anyway able to empty the Recyled folder through windows (XP btw) thanks to the excludedir option. I indeed just found that keeptree has to be set to No for the excludedir option to work nicely.

If anyone has a clue about how to have the exclude option working it would be a blessing.

Thanks in advance,
--
Kad

Offline

 

#2 2008-04-15 00:10:42

kad
New member
Registered: 2008-04-14
Posts: 2

Re: Recycle bin on 1.04 firmware : working, but not completely

Sorry for my too quick posting.

All options work fine with :
vfs objects = recycle
recycle:repository = /mnt/HD_a2/Recycled
recycle:keeptree = No
recycle:touch = No
recycle:versions= No
recycle:maxsize = 0
recycle:exclude = *.tmp *.temp ~$* *.~??
recycle:excludedir = /mnt/HD_a2/Recycled/

I still wonder why keeptree cannot live with excludedir but I can live with that.

Regards,
--
Kad

Offline

 

#3 2008-08-29 00:38:32

jrbilodeau
Member
Registered: 2007-11-26
Posts: 47

Re: Recycle bin on 1.04 firmware : working, but not completely

I had some problems with the above recycle bin samba mode, so here is what i did to get it working perfectly.

first open a telnet session ( i use putty) and type
cp /etc/samba/smb.conf /ffp/smb.conf
chmod 777 /ffp/smb.conf

next in windows explorer navigate to the ffp folder on Volume_1 and open up the smb.conf file with a linux friendly text editor i use notepad++

under the [ global ] setion i added the following lines

vfs object = recycle
recycle:repository = .recycle
recycle:directory_mode = 0777
recycle:subdir_mode = 0777
recycle:keeptree = Yes
recycle:versions = Yes
recycle:touch = No
recycle:touch_mtime = No
recycle:maxsize = 0
recycle:exclude = *.tmp,*.temp, ~$*, *.~??
recycle:exclude_dir = /.recycle

save it then add the following lines to fun_plug

# Restart Samba with my configuration
cp /ffp/smb.conf /etc/samba/smb.conf
smb restart

then restart you dns323

NOTE: i tested this before applying it to the funplug incase something didn`t go right i could simply reboot and go back to the original smb.conf file i suggest you do the same

Offline

 

#4 2008-08-29 05:05:34

jrbilodeau
Member
Registered: 2007-11-26
Posts: 47

Re: Recycle bin on 1.04 firmware : working, but not completely

btw, you don't need to create the .recycle directory, it will do it on its own. also it will create 1 per drive, so if you have Volume_1 and Volume_2 it will make one for each as soon as something is deleted.

Offline

 

#5 2008-08-29 16:20:53

jrbilodeau
Member
Registered: 2007-11-26
Posts: 47

Re: Recycle bin on 1.04 firmware : working, but not completely

Just a suggestion, but i think it would be worth adding this to the better samba part of the wiki. i keep seeing requests of undelete and recovering deleted files. adding a recycle bin would help to avoid this.

Offline

 

#6 2008-08-31 17:12:25

rcblackwell
Member
From: Pickering, ON
Registered: 2008-05-19
Posts: 204
Website

Re: Recycle bin on 1.04 firmware : working, but not completely

jrbilodeau wrote:

Just a suggestion, but i think it would be worth adding this to the better samba part of the wiki. i keep seeing requests of undelete and recovering deleted files. adding a recycle bin would help to avoid this.

I've taken the liberty of adding jrbilodeau solution to the end of the "BetterSamba' Wiki.


Bob Blackwell
Pickering, ON

Offline

 

#7 2008-08-31 23:52:19

rcblackwell
Member
From: Pickering, ON
Registered: 2008-05-19
Posts: 204
Website

Re: Recycle bin on 1.04 firmware : working, but not completely

Great addition to my DNS323 however I'm having a problem with the recycle:exclude_dir command and would appreciate some insight.

When I set recycle:exclude_dir like this

Code:

recycle:exclude_dir = /mnt/HD_a2/.Trash_Bin

or like this

Code:

recycle:exclude_dir = /.Trash_Bin

deleting a directory from the recycle bin results in the deleted item being re-saved in a directory one deeper than it was deleted from. For example; if I delete a file named U:\.Trash_Bin\Robert\Railroad & Co\TrainController\ it is resaved as U:\.Trash_Bin\.Trash_Bin\Robert\Railroad & Co\TrainController.

The following has been added to the Global section of samba.config

Code:

; Create Recycle Bin for Deleted Files
vfs object = recycle
recycle:repository = /mnt/HD_a2/.Trash_Bin
recycle:directory_mode = 0777
recycle:subdir_mode = 0777
recycle:keeptree = Yes
recycle:versions = Yes
recycle:touch = No
recycle:touch_mtime = No
recycle:maxsize = 0
recycle:exclude = *.tmp,*.temp, ~$*, *.~??
recycle:exclude_dir = /.Trash_Bin

Last edited by rcblackwell (2008-09-01 00:07:54)


Bob Blackwell
Pickering, ON

Offline

 

#8 2008-09-01 17:24:52

rcblackwell
Member
From: Pickering, ON
Registered: 2008-05-19
Posts: 204
Website

Re: Recycle bin on 1.04 firmware : working, but not completely

rcblackwell wrote:

Great addition to my DNS323 however I'm having a problem with the recycle:exclude_dir command...

Although not the ideal solution I have found a way around this problem. There seems to be a "rights" issue when the configuration is added to the [ Global ] section of samba.conf. So, rather than add the recycle commands to the [ Global ] section of the config file I've included them with each share that requires recycling capabilities. An example follows;

Original Share Configuration

Code:

[ Data ]
comment = Robert's Data (R/W)
path = /mnt/HD_a2/Data
valid users = Robert
read only = No
guest ok = No
oplocks =  Yes
map archive = Yes

Revised Share Configuration

Code:

[ Data ]
comment = Robert's Data (R/W)
path = /mnt/HD_a2/Data
valid users = Robert
read only = No
guest ok = No
oplocks =  Yes
map archive = Yes
; Create Recycle Bin for Deleted Files
vfs object = recycle
recycle:repository = .Trash_Bin
recycle:keeptree = Yes
recycle:versions = Yes
recycle:touch = No
recycle:touch_mtime = No
recycle:maxsize = 0
recycle:exclude = *.tmp,*.temp, ~$*, *.~??
recycle:exclude_dir = /.Trash_Bin

Bob Blackwell
Pickering, ON

Offline

 

#9 2008-09-03 18:39:57

jrbilodeau
Member
Registered: 2007-11-26
Posts: 47

Re: Recycle bin on 1.04 firmware : working, but not completely

When i was tryin to get it working for mine, if i set the recycle:repository= to a specific path like \mnt\HD_a2\recycle it gave me problems. thats why i set it to
recycle:repository=.recycle
recycle:exclude_dir = /.recycle

it keeps it drive independant. also i let it create the .recycle directory itself. that seemed to work for me.

Offline

 

#10 2009-09-13 17:57:33

bluebird
Member
Registered: 2009-08-01
Posts: 5

Re: Recycle bin on 1.04 firmware : working, but not completely

I found a way to make the exclude_dir option working , even when keeptree is set to yes and/or if the recycle bin is set under the global section.
It seems that you mustn't begin your path with '/' in the exclude_dir option. So set your paths without '/' at the beginning.

This worked for me:

Code:

[ global ]
....
vfs object = recycle
recycle:repository = .recycle
recycle:directory_mode = 0777
recycle:subdir_mode = 0777
recycle:keeptree = Yes
recycle:versions = Yes
recycle:touch = No
recycle:touch_mtime = No
recycle:maxsize = 0
recycle:exclude = *.tmp,*.temp, ~$*, *.~??
recycle:exclude_dir = .recycle,DATA/Documents/everyone/profile/thunderbird,DATA/Documents/everyone/profile/firefox

Offcourse you can also put this under a share (at share level).
But if set under the global section and write this to the flash memory (written in the file smb.default), then you don't need to add a copy command to fun_plug to replace the the smb.conf file.
Another advantage is that this way doesn't conflict in the webinterface (at least with the one of the CH3SNAS) under the advanced --> network access section).

Info to write to flash:
easy way:
alter the smb.default and/or smb.conf files. Go to the webinterface. Add a share and delete it again. Files are now written to flash.
--> watch out with this way, doesn't work always for 100%, it can make your unit inaccessible trough samba.

other way:
telnet your device.
type the following command:'mount -t minix /dev/mtdblock0 /sys/mtd1'. Change the smb.default file in /sys/mtd1. Type the following command 'sync'. Type the following command:'umount /sys/mtd1'.
Do the same with mtd1, so:
type the following command:'mount -t minix /dev/mtdblock1 /sys/mtd2'. Change the smb.default file in /sys/mtd2. Type the following command 'sync'. Type the following command:'umount /sys/mtd2'.

Update: the option doesn't seem to apply to subdirectories of the directories specified in exclude_dir. Anyone has a solution for this other than specify them all one by one?

Last edited by bluebird (2009-09-13 19:24:58)

Offline

 

#11 2019-05-02 13:59:02

GeorgeSTM
New member
Registered: 2019-05-02
Posts: 1

Re: Recycle bin on 1.04 firmware : working, but not completely

Hello friends!

I have 2 pcs DNS-323 (both have RAID1 configuration) and I have successfully activated, on both, the Recycle Bin.
Here is what I have done:

1. firmware update to v1.10C (http://ftp.dlink.ru/pub/NAS/DNS-323/Firmware/)
2. install Fonz fun_plug for Telnet access, Version “OABI” for OABI-devices like the DNS-323 and CH3SNAS (https://nas-tweaks.net/371/hdd-installa … s-devices/)
3. connect (Telnet port 23) with PuTTY to the DNS-323, no user and password needed (https://www.chiark.greenend.org.uk/~sgt … atest.html)
4. change root password:
usermod -s /ffp/bin/sh root
mkdir -p /ffp/home/root/
sed -ie 's#:/home/root:#:/ffp/home/root:#g' /etc/passwd
pwconv
passwd
5. store local on your NAS the password to have it after reboot:
wget --no-check-certificate  http://wolf-u.li/u/172/ -O /ffp/sbin/store-passwd.sh
store-passwd.sh
6. exit PuTTY, restart DNS-323 from the web interface and wait 3 minutes to reboot
7. connect (Telnet port 23) with PuTTY to the DNS-323, no user and password needed, and verify that you can login with your root password
8. after successful root login type:
mount -t minix /dev/mtdblock0 /sys/mtd1
vi /sys/mtd1/smb.default
9. insert at the end of section [ global ] this code:
vfs object = recycle
recycle:repository = .recycle
recycle:directory_mode = 0777
recycle:subdir_mode = 0777
recycle:keeptree = Yes
recycle:versions = Yes
recycle:touch = No
recycle:touch_mtime = No
recycle:maxsize = 0
recycle:exclude = *.tmp,*.temp, ~$*, *.~??
recycle:exclude_dir = /.recycle
10. save and exit vi editor, type:
:wq
11. visualize if your edit is correct, type:
less smb.default
12. sync the smb.default and unmount:
sync
umount /sys/mtd1
13. repeat steps 8-12 and use mtd2 instead of mtd1
14. delete Fonz fun_plug:
cd /mnt/HD-a2
rm -r ffp
rm ffp.log
rm fun_plug
ls (verify that ffp, fun_plug and ffp.log doesn't exist anymore)
exit
15. restart DNS-323 from the web interface and wait 3 minutes to reboot
16. verify with PuTTY that Telnet is not running anymore (for security reasons)
17. delete some files and folders (that you have also in another place as backup) and verify the .recycle folder in your root \\xxx.xxx.xxx.xxx\Volume_1-1\.recycle
Have fun!

Thank you jrbilodeau and bluebird for your code!!!
Thank you Uli for the Fonz fun_plug!!!
Thank you all for this super Forum!!!
Greetings from Romania smile

Last edited by GeorgeSTM (2019-05-02 14:14:05)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB