2

I used to just press the Delete key on selected files on Nautilus, and then it would trash the file(s) without confirmation. That was very convenient.

I later decided that my Trash may contain sensitive files, and thus moved it to the eCryptfs Private folder, and created the symlink ~/.local/share in its place.

Thereafter, when I Delete files that are inside eCryptfs, behavior is as expected, no problems. On the other hand, when I try to delete files in my home directory but outside eCryptfs, I get this message:

File can't be put in trash

The same behavior is seen when deleting items from a different drive...

Is there a workaround to just automatically put it in my encrypted trash anyways even if it belongs to another/unencrypted drive/mount?

If that really cannot be done, then is two Trashes possible? One for encrypted files and another for unencrypted ones?

2
+25

When you move files to trash with Nautilus or gvfs-trash they are never moved to a different volume. They are “renamed” to a different directory entry (inside the trash directory) on the same volume. Note that the documentation of that function explains that files cannot be “renamed” onto different volumes or mount points.

This means that moving a file to the trash from an encrypted volume (whether by eCryptFS, dm-crypt/LUKS or anything else that requires the kernel to mount something) will never result in the decryption of the file. Hence I don't think it's beneficial to link ~/.local/share/Trash to something underneath ~/Private. You can test that with the following commands:

cd ~/Private
touch foobar.txt
gvfs-trash foobar.txt
ls -1 ~/.local/share/Trash/files/foobar.txt* ~/Private/.Trash-*/files/foobar.txt*

which should give you something like:

ls: cannot access /home/david/.local/share/Trash/files/foobar.txt*: No such file or directory
/home/david/Private/.Trash-1000/files/foobar.txt

Interestingly the file doesn't turn up in my virtual trash folder:

$ gvfs-ls trash:// | grep -cwFe foobar.txt
0

(While the same works when I do gvfs-trash ~/foobar.txt.)


For the reason outlined above I think it's impossible with the current implementation of gvfs-trash to have a trash on a different volume than the original volume of the file sent to trash.

  • Hi David, thanks for posting. We do understand that this is the normal behavior. But then, as the question's intent really is, is there a workaround through this? – Majal Jun 4 '16 at 14:11
  • Yes, the second one. An encrypted trash bin no matter where the file came from. :-) – Majal Jun 5 '16 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.