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.
Related videos on Youtube
daniels
Updated on September 18, 2022Comments
-
daniels over 1 year
How can I mount a NTFS partition so that all user accounts on my machine have write access? My mount options are
nosuid,nodev,nofail,x-gvfs-show,nobootwait,uid=1000,gid=1002,fmask=113,dmask=002
This gives me write access but when other users try to delete a file the error message pops up
Cannot move file to trash, do you want to delete immediately?
As I understand this is because they don't have write access which is what I want to change.
I created a new group (with
gid=1002
) and assigned it as primary group to both user accounts but that didn't help. I also tried mounting without thefmask
,dmask
anduid
options.-
Admin over 10 yearsAre you still facing this issue? Try ditching
fmask
anddmask
, and addumask=001
. This basically gives access to everyone, except execution permission to "others". -
Admin over 10 yearsYes, the issue still exists. I will try yout suggestion.
-
Admin over 10 yearsI tried your suggestion, but it didn't do the trick.
-
Admin over 10 yearsI found out what the issue is. To sum up: that error doesn't mean there's a "write access" issue, it just means that you can't move files to the trash, but instead you'll delete permanently. However, you should have write access normally. Try creating or deleting files. I'll post an answer in about 7 hours from now.
-
Admin over 10 yearsWell, yes, both users can create new files. But only my account (uid=1000) can move files to the trash. The other user (uid=1001) can't!
-
Admin over 10 yearsYeah, exactly. This should work: remove all
uid
,gid
,dmask
,fmask
andumask
options and just put in the option calledpermissions
. You should then be able to move to trash with the other user.
-
-
daniels over 11 yearsI tried but it didn't help. I also tried various combinations of
uid
andgid
. It seems thatgid
doesn't have any effect at all. Only the user that has hisuid
set in the mount options can move files to the trash but others still receive the error message. -
Sadi over 11 yearsI know, this is a bit frustrating for non-expert users like us. dmask and fmask values above (giving rw access to all) should be okay for you. It seems the rest needs a little bit more tinkering. Perhaps you can also try auto,users instead of defaults and gid=100 instead of gid=46.
-
daniels over 10 yearsWow, somehow I missed your answer... I will definitely look into this although some early testing (mounting with
permissions
but withoutuid=1000
) did not work. Even user with uid 1000 was unable to move files to trash...weird. But thanks anyway, I will give it a few more tries and see if it works out.