1

I could not see "Move to Trash" option on context menu, but only seeing "Delete" option that make the file completely removed (Are you sure you want to permanently delete “file.txt”?). I also tried chown/chmod on the files and folders that I am trying to move to trash. So, I can NOT remove files via Sublime Text 3 too.

If I do sudo nautilus and opening the file explorer then I can see "Move to Trash" option, but then can not see the file that I moved to trash using this option in "Trash".

E.g;

# kerem is superuser
sudo chown kerem:kerem /var/www/file.txt
sudo chmod 0777 /var/www/file.txt

Trash perms;

kerem@kerem:~/.local/share$ ls -la | grep Trash
drwx------  5 kerem kerem  4096 Ara 11 04:09 Trash

ubuntu-context-menu

Using 14.04 64bit, desktop version and /home and /var/www are on different partitions like sda1 and sda7 (both ext4 / -> /dev/sda6 and /home -> /dev/sda7). But no dual system alongside Ubuntu like Windows.

Thank you.

  • I'm assuming you're not running your file browser (eg nautilus) as superuser? What are the permissions and ownership of your home directory and your ~/.local/share/Trash directory? – thomasrutter Dec 11 '14 at 2:39
  • @neon_overload; kerem is root, so superuser. Also updated question, thanks. – K-Gun Dec 11 '14 at 2:44
  • Not sure what you mean by that kerem is superuser - are you running nautilus (or whatever file browser you're using) as superuser? If so, why? And how - with sudo, or gksu, or some other way? – thomasrutter Dec 11 '14 at 3:02
  • @neon_overload; I updated my question, could you see it again please? – K-Gun Dec 11 '14 at 11:45
2

After wasting a few hours, here is the solution;

sudo -s
cd /

Work out your user account's id - it's usually 1000

getent passwd "username"

to get the UID and GID (for later use)

UID=$(getent passwd "username" | awk -F: '{print $3}')
GID=$(getent passwd "username" | awk -F: '{print $4}')

Make a new trash directory with the id we found above

mkdir .Trash-1000

Change the permissions of new directory to allow us to access it

chmod 777 .Trash-1000 && chown ${UID}:$GID .Trash-1000

Additionally, I can make a sym link into ~/.local/share/Trash to remember there is a trash more, so need to be emptied sometimes. :)

ln -s /.Trash-1000 ~/.local/share/Trash

Credits: https://askubuntu.com/a/516825/179045

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.