(About removable media, not the case from the user since it was a bug solved with an update)
This behaviour happens because when the drive is mounted you are not considered the owner so a trash bin cannot be created. No uid or gid was assigned and since a trash bin folder cannot be created in the drive you are only offered the choice to delete the files automatically.
In that case you have 2 options: cut the files in to your Linux file system and delete them there (which defeats the purpose of press delete and the files are deleted) or make sure you are assigned the correct permissions when mounting the drive.
Create a new rule for your auto-mounted drives with these lines, use your favorite text editor for that
gksudo gedit /etc/udev/rules.d/10-my-media-automount.rules
# vim:enc=utf-8:nu:ai:si:et:ts=4:sw=4:ft=udevrules:
#
# /etc/udev/rules.d/10-my-media-automount.rules
# start at sdb to ignore the system hard drive
KERNEL!="sd[b-z]*", GOTO="my_media_automount_end"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="my_media_automount_end"
# import some useful filesystem info as variables
IMPORT{program}="/sbin/blkid -o udev -p %N"
# get the label if present, otherwise assign one based on device/partition
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"
# create the dir in /media and symlink it to /mnt
ACTION=="add", RUN+="/bin/mkdir -p '/media/%E{dir_name}'"
# global mount options
ACTION=="add", ENV{mount_options}="relatime"
# filesystem-specific mount options (777/666 dir/file perms for ntfs/vfat)
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},gid=46,dmask=000,fmask=111,utf8"
# automount ntfs filesystems using ntfs-3g driver
ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", RUN+="/bin/mount -t ntfs-3g -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"
# automount all other filesystems
ACTION=="add", ENV{ID_FS_TYPE}!="ntfs", RUN+="/bin/mount -t auto -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"
# clean up after device removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'"
# exit
LABEL="my_media_automount_end"
Reboot your computer and your ntfs drives will be mounted using this custom rule, to change the permissions for the mounted drive have a look at the line $env{mount_options},gid=46,dmask=000,fmask=111,utf8"
, the option gid=46
should mount the ntfs drive with group privileges (46(plugdev)
is the group that allows a user to mount a drive in Ubuntu), fmask
and dmask
settings to write, create, delete files/folders on the drive.
Change it according to needs. You will need to sort out other file systems by yourself according to to each type but this should get your started.
(Source for the udev
rule)
Best Answer
I had the same problem and found out that the trash had the wrong owner. So I deleted the trash folder and made a new one.
Steps:
cd ~/.local/share
ls -ld Trash
root
- delete the folder with:sudo rm -r Trash
mkdir -m 700 Trash
Hope I could help and that it solved your problem, because it did for me.