Ubuntu – Delete Files To Trash

fstabtrash

Ubuntu 13.04 dual-booting next to Pre-installed Win 8.

I can only delete files to the trash can when I am in the home directory, even for files which belong to me (usually inside /var/www). Selecting the file in nautilus and hitting delete does nothing. Right clicking and selecting delete asks me if I want to delete permanently. Here's what I know:

  1. These are files owned by me. /var is owned by root, but www (and all files within) are owned by me.
  2. I have a Trash folder at /home/(name)/.local/share/Trash; it seems to work fine for files I want to delete from my home directory.
  3. This machine was a Win 8 Machine which gave me a lot of trouble getting Ubuntu to run alongside on; I am not sure if this is an issue. When I created the partitions, I made a home partition separate, so I am thinking this is probably my problem.

Here is my fstab.

This blog post looked like the exact problem I have, but I am not experienced enough with fstab to get this to work. I tried adding my UID to /:

UUID=bb3ada65-be09-4b18-b091-9b3c95534cfd / ext4 errors=remount-ro,uid=1000 0 1

But then fstab couldn't load when I rebooted, and I had some trouble getting my system to load back up – don't really want to experiment with this since it takes so much time just to try something out.

edit: after reading the man for fstab a bit, it looks like UID is an option for fat; / is ext3 so this isn't the problem, I am guessing.

edit2:

My permissions seem fine:

cd /var/www
touch test\ doc.txt
ls -la
...
-rw-rw-r--  1 tom  developers        0 Jun 12 16:55 test doc.txt
...
rm test\ doc.txt

Notice I don't need sudo for creating or deleting the file from the cli, nor do I need to be root to delete in nautilus – I just can't delete to my trash for some reason.

Best Answer

When nautilus trashes something, it doesn't want to have to move it across partitions. This is because it takes a lot longer to move between partitions, and then if you remove the partition then the trash has no place to restore to.

Anywhere that is on the same partitions as your home directory is sent to ~/.local/share/Trash. This works across the entire root partition on setups which only have one partition.

On any other partition nautilus will make a .Trash-1000 folder on the root of the partition, then send all trashed files into that. This works rather well on external drives that you have full read/write access to, though it won't work if you don't have write permission to the root of the drive.

Because your / partition isn't the same as your /home partition, and a .Trash-1000 doesn't exist with write permission at the root of your system, nautilus will fail to trash files. Thus the delete key won't work and a trash action won't be available in the menus.

You could try using a root nautilus and deleting one file so that the /.Trash-1000 folder is created correctly, then using sudo chmod -R 777 /.Trash-1000 to give yourself permission to access a trash on the / filesystem. I cannot confirm that this will work though you could give it a try.