Peculiarities of Samba’s recycle bin

A nice feature of a Samba server is the optional recycle bin, which stores all files and folders that were deleted from a client on a network share. However the Samba recycle bin behaves different in comparison to the Desktop recycle bins of Windows, Mac OS X and Linux.

This posting describes the peculiarities of this Samba feature and how to use this function reasonably.


The recycle bin of Samba is different to those on Desktop computers. The objects that were deleted on a network share by connected client computers does not appear in the user’s Desktop recycle bin but in a hidden folder on the share. The name can be specified in the Samba configuration, e.g. .recycle.

Every share has its own .recycle folder. All deleted files and folder of a share of all users are stored in this special folder. The deleted objects are stored under the user name while preserving the original path if the option keeptree is activated in Samba’s configuration

That means, if a user john deletes the file \\nas\my-share\Documents\Text.txt it appears in \\nas\my-share\.recycle\john\Documents\Text.txt.

If the option versions is activated two files with the same name that are deleted will both be kept in the recycle bin. Newer deleted versions of a file will be called Copy [#x] of [filename].


After deleting a file or folder, Samba sets the permission in that way that only the appropriate user is able to access that file. That means, files which were deleted by user jane are stored in \\nas\my-share\.recycle\jane. But only user jane has access to it. User john can “see” the folder jane but it appears empty to him.

Easy Access to deleted objects

Since the recycle bin-folder .recycle is hidden, users are not able to “see” and to use it. That means, to make the folder visible to them one of the following procedure has to be performed:

  • Set a symbolic link on the share (platform independent). E.g. via SSH:
    ln -s /path/to/share/.recycle /path/to/share/Server-RecycleBin
  • Create a Desktop shortcut of .recycle on the Desktop of the users.

But be advised that every share has its own .recyle folder if more than one are available!


The recycle bin of a Samba share is a useful and easy feature to reconstruct deleted files on a Samba network share. But there are some issues to consider because the behavior of a Samba recycle bin is different to Desktop ones of current operating systems.

It is strange that native Windows-Server- and Client operating systems – which Samba partly reproduce – do not provide that feature. But since Windows Server 2003 and Windows XP, Microsoft provides the Shadow Copy Technology (VSS), which offers a similar functionality.

Related Links

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *