Koozali.org formerly Contribs.org

How to implement standard M$ local "Recycle Bin" b

How to implement standard M$ local "Recycle Bin" b
« on: September 06, 2005, 08:53:28 PM »
How to implement standard M$ local "Recycle Bin" behavior for redirected "My documents" folder and network shares.


Hallo,

First of all, compliments for a GREAT SERVER SOFTWARE.

Many users asked me this question:
"Why, when I delete a file or folder on the network share, it's gone forever, why I don't see it in my "Recycle Bin"".
Hmm..., Good question...

Conform to several posts on the Internet regarding Windows 2003 Server environment,
"Recycle Bin" for network shares does not work.
Some interesting readings:
http://www.tech-archive.net/Archive/Windows/microsoft.public.windows.server.general/2004-12/1840.html
http://www.windowsnetworking.com/articles_tutorials/Windows-Server-2003-Volume-Shadow-Copy-Service.html
http://msdn.microsoft.com/msdnmag/issues/05/02/RecycleBinforWSS/default.aspx
http://www.windowsitpro.com/Article/ArticleID/39404/39404.html

In one of them I found:
"Local Windows file systems include the Recycle Bin on the desktop, from which you can recover a deleted file.
However, you can't recover deleted files on network shares unless you install third-party software.
One thing VSS does is replicate the Recycle Bin for the network."

VSS = Volume Shadow Copy

This is not nice for many users! Deleted hours of work by mistake, and stress.

Me too, I was very disappointed by a lack of this functionality. Perhaps lack "By design"?
After many hours of investigation and testing, I have discovered that for "Redirected Folders" in "Roaming Profile"
every folder placed below "My documents" will benefit from standard functionality of "Local Recycle Bin" in Windows.
This apply also to the network shares, if they are soft linked to the directory below "My documents".
It means that the implementation of VFS recycle module for Samba is not needed anymore,
and a SME server, as well as other Samba servers of course, can provide this functionality without extra "third-party" software (KISS).

To find out how I have done it, try this:

0. Enable Roaming Profiles.

1. Edit registry to redirect "My documents" folder to Home share on SME server.
It should look like this:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

Desktop = %LOGONSERVER%\%USERNAME%\My documents\desktop
My Pictures = %LOGONSERVER%\%USERNAME%\My documents\My pictures
Personal = %LOGONSERVER%\%USERNAME%\My documents

Leave the rest unchanged.

2. mkdir -p /etc/e-smith/templates-custom/etc/smb.conf
   cd /etc/e-smith/templates-custom/etc/smb.conf
   cp /etc/e-smith/templates/etc/smb.conf/50homes /etc/e-smith/templates-custom/etc/smb.conf/50homes
   vi 50homes (or use pico)

edit 50homes to read as below:

[homes]
comment = Home directory
browseable = no
guest ok = no
read only = no
writable = yes
printable = no
create mode = 0660
force create mode = 0660
directory mode = 0770
force directory mode = 0770
path = /home/e-smith/files/users/%S/home
hide files = /desktop.ini/RECYCLER/desktop/Thumbs.db/

(last line is needed to hide "RECYCLER" and other files and folders from the user)

3. expand-template /etc/samba/smb.conf

4. Logout and login to Windows.

5. Test Your Recycle Bin, it should work as in Windows, except from now "My documents" is on the network!


That's nice, isn't it?

Let's take this a little bit further..

Suppose, that we want to have a "Recycle Bin" functionality for a network share.
We want also that this share is easy accessible for the user from "My documents".

Try this:
1. Start ssh and login to your SME server as root.
2. Go to the home directory of an user:
   cd ~<USER_NAME>/home/"My documents"
3. ln -s /home/e-smith/files/ibays/<SHARE_NAME>/files <SHARE_NAME>
4. Login in Windows as <USER_NAME>
5. Go to "My documents" (Start->My documents)
6. Explore <SHARE_NAME> and make some files or folders.
7. Delete them.
8. Look in the "Recycle Bin" on <USER_NAME> desktop and restore them.
   They should be back in the right place.

There is even more.
You can put quota on the "Recycle Bin" using it's properties in Windows.
This can be done separately for C: drive and "My documents"
If the name "My documents" is to confusing, You can rename it to something like "Documents" and below this create:
"My documents" - lives in Home of the user.
"Company documents" - soft link to some share on the server
and so on.

Be aware, that implementing "Roaming profiles" with "Folder redirection" need a good knowledge of MS environment.
One of the tricky things is the default policy for a hidden "Local Settings" folder. It does not roam.
In this folder very important information is stored, and in my opinion it should roam by default.
Because of a possibility of being "Large" (OE or Outlook mailboxes), my advise is to redirect this folder to a hidden share
(of course below "My documents" in the home dir on the server. This can be done as above with a "Desktop" folder.
You also need to change registry and exclude excluded profile directories:

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon]
"ExcludeProfileDirs"="Local Settings;Temporary Internet Files;History;Temp;Local Settings\\Application Data\\Microsoft\\Outlook"

In my situation I only have:
"ExcludeProfileDirs"="Temporary Internet Files;History;Temp"

Now the settings for OE and Outlook, as well Mailboxes, are stored on the server, and don't travel with a user profile.

The benefits are:

1. All valuable user data is included in your backup strategy automatically. (when doing a full server backup)
2. Logon and Logoff speed. (only a small part of a profile is traveling between client and server)
3. Simplified upgrades and data migration.
4. Simplified user management. (lot of things can be scripted)

Drawback's? Yes:

1. Network failure = no "My documents", no Mail, no printing. But who cares?

Only You - SME server Admin.

So simple as that,
But use this at your own risk.

Cheers,

Eryk

How to implement standard M$ local "Recycle Bin" b
« Reply #1 on: March 21, 2007, 08:48:50 PM »
Eryk,

Fantastic article.   :P Haven't applied it yet but I do get the idea behind it and wanne enhance it a little bit more.

In the past I haven been experimenting (failures made me give up at that time) with automount. The intention was to have SSH, VPN or FTP hooking up to the users default connected network-shares.

When you think about your structure you can easy say that you gained another benefit. When Automount would be working the users can hook up to their documents from anywhere and don't need to bother other people at work to mail it to them or wait till they are back at the office.

This gives me the thought again that I have been too easy in only using "yum install" lately and didn't do enough research myself.  :oops: I will have another look at automounting soon again and maybe this time with better results.

Harro