Mount NTFS partition with write access for everyone
As I understand this is because they don't have write access which is what I want to change.
No, this error message does not mean that they don't have write access. If they didn't have write access, you would not be able to right click and "Move to Trash" or "Delete" a file, or use the Del keyboard button. But since you're getting this error, it means that the users do have access.
After two hours of search, and reproducing this error on my computer, here's what I found out.
Explanation
Permissions (owner, group owner, file and directory permissions) are set at the time of mounting. Only the owner can move files to trash. Why? Because when you move files to trash in an NTFS partition, a folder called .Trash-<uid>
is created in the root directory of the partition, where <uid>
is the uid
of the user, and the folder's owner will be the user that's trying to delete. For example, if the username is daniels
and the uid
is 1000, a folder called .Trash-1000
is created, and daniels
would be the owner.
So, if daniels
is the owner of the partition, he'll be able to do this normally. However, if another user (let's say called alaa
, and uid=1001
) tries to delete something, the system tries to create a .Trash-1001
folder, with the owner alaa
. But, on NTFS, the permissions are set at the time of mounting (example: it was set to daniels
), and the "owner" of any file cannot be changed, and so the system fails to create the .Trash-1001
folder, giving you the prompt Cannot move file to trash, do you want to delete immediately?
.
To test this, try manually creating a folder in the root directory of the partition named .Trash-1001
(the owner will be set to the owner of the partition). You'll find that hitting Del on the keyboard on any file/folder will not do anything, and the option when you right click an item will change from Move to Trash
to Delete
. I can't explain why it changes to Delete
, but this is just to identify that the problem is indeed in the .Trash-1001
folder.
In my opinion, I classify this as a bug.
Solution (soft of...)
Remove all of your uid=
, gid=
, dmask=
, fmask=
, and umask=
options from your mount command, and add permissions
, so I guess your line should be like this:
nosuid,nodev,nofail,x-gvfs-show,nobootwait,permissions
I've tried this on my computer, and it works; both users can move to trash when using the NTFS hard disk.
Here's a demonstration:
alaa@aa-lu:~$ sudo mount -o rw,permissions /dev/sdc2 /media/he Using default user mapping alaa@aa-lu:~$ ls /media/he -la total 104 drwxrwxrwx 1 root root 8192 Sep 24 21:20 . drwxr-xr-x 6 root root 4096 Sep 24 21:18 .. drwxrwxrwx 1 root root 4096 Dec 15 2012 Files on my hard disk drwxrwxrwx 1 root root 4096 Jul 9 12:18 $RECYCLE.BIN drwx------ 1 root root 0 Jan 22 2012 System Volume Information
Then I went and deleted something using my username alaa
, then logged in as another user aaa
and deleted something too. Both of them could delete, and this is how the NTFS partition looks like:
alaa@aa-lu:~$ ls /media/he -la total 104 drwxrwxrwx 1 root root 8192 Sep 24 21:20 . drwxr-xr-x 6 root root 4096 Sep 24 21:18 .. drwxrwxrwx 1 root root 4096 Dec 15 2012 Files on my hard disk drwxrwxrwx 1 root root 4096 Jul 9 12:18 $RECYCLE.BIN drwx------ 1 root root 0 Jan 22 2012 System Volume Information drwx------ 1 alaa alaa 0 Sep 24 21:20 .Trash-1000 drwx------ 1 aaa aaa 0 Sep 24 21:19 .Trash-1002
I don't know how it manages to do that, but it just does.
I found this page: Ownership and Permissions | Tuxera that explains this, as well as a forum post (http://www.tuxera.com/forum/viewtopic.php?f=2&t=27540) that has some useful information. However, unfortunately I haven't read them yet, so I can't explain exactly what this permissions
option does.
I said "Solution (sort of...)" in the title of this section because now you're not controlling who is the owner of the partition, not group owner, nor the read-write permissions. But, when mounting with the permissions
option, you can see a "Using default user mapping", so as far as I understood, there's a "user mapping" thing that can be created to be used with permissions
, and that mapping will have the owner/permissions that we want to set. I also have not tried mounting using permissions
along with uid=
and all those other options (the Tuxera link I posted should explain that though), but that might also work, by controlling owner/permissions and at the same time give access to Trash.
When I read those links, I'll update my answer.