Allow for 'Move to trash' instead of 'permanently delete' for mounted partition?
In a dual boot system with Windows 8 and Ubuntu 18.04, two partitions (let's call it the Data drive and the Media drive) are NTFS, and are accessible to both Windows and Ubuntu. To be able to access files on those drives via Ubuntu, I had to click on the Drive icon in Nautilus and Ubuntu would mount the partition onto /media/
and if I deleted any files from those partition, the files would go to Trash.
Since it was cumbersome to click the icon to mount it everytime, I wanted the partitions to auto-mount when I login to Ubuntu. I followed these steps and it works.
However, if I try to delete any file from the Media drive, the only file deletion option shown to me in the right-click menu is "Delete permanently".
How can I have the move to Trash option re-appear? Also I'd like to understand why it only allows permanent deletion?
Solution 1:
According to this answer, it can be solved by adding uid=1000
.
To know your account's UID, open the file /etc/passwd
and search the last few lines of the file for your username. In my system there were two users, so there were two lines specifying uid's for the first user and the second user. The second user's uid was 1001.
Add the uid's to the mount options you see in Disks / Gnome Disk Utility. Specifically, you would change your mount options to nosuid,nodev,nofail,x-gvfs-show,uid=1000
.
Note: By doing this, you'd be giving folder permissions for only your account. The other user won't be able to move files to trash because their uid is not mentioned in the mount options. A better workaround is needed.
Solution 2:
For external mounted disk or partition, create a /.Trash-$UID
directory, e.g.
cd /media/MYDRIVE
sudo mkdir -m777 -v .Trash-$UID
sudo chown $USER .Trash-$UID
Then re-open Nautilus and re-check the context menu.