Linux system ntfs-3g Permissions configuration detailed

Source: Internet
Author: User

This knowledge point incredibly did not record, sure enough time later will forget, hence record.

Under normal circumstances, we mount NTFS under Linux, is installed after the ntfs-3g, namely:

# mount-t Ntfs-3g/dev/sdb1/mnt/data
This can be done temporarily, but it will involve permission issues, that is, all files under/mnt/data must have root permissions. So we added some parameters so that the current user can also access the modifications:

# mount-t Ntfs-3g-o Uid=username,gid=users/dev/sdb1/mnt/data # UID is the current username, GID is the Users group
The average person so far, temporary demand, but obsessive-compulsive disorder, see the partition, all files are 777 permissions express very uncomfortable, so:

# mount-t Ntfs-3g-o Uid=username,gid=users,umask=022/dev/sdb1/mnt/data
Umask says, remove the permission.

Sugo
Here, add Linux permissions for Sugo, the first s to express suid, sgid, sticky, generally not used, the following appendix incidentally, here Next, UGO, three locations, each with a rwx to express the rights, Rwx said, read, write, Execution (access), respectively, with the number 4, 2, to say, the corresponding relationship is as follows:

Owners (U) group (G) Other (O) corresponding digital authority
R W x R W x r W x permission
4 2 1 4 2 1 4 2 1 777
4 2 1 4 0 1 4 0 1 755
4 2 1 4 2 1 4 0 0 774
4 2 1 0 0 0 0 0 0 700
4 2 0 4 0 0 4 0 0 644
So it's clear that 644 means that u have read and write access, G has read-only access, and O has read-only access.

Umask, Fmask, dmask
umask– permissions to filter directories and files
fmask– Permissions to filter files
dmask– Permissions to filter directories
The description is clear, if you want to have 755 permissions, then the permission = 777-022, each subtract, get 755, that is, umask = 022, the actual permissions for 755,fmask, dmask the same, if you want to have 644, 644 = 777-133 ......

Now clearly, the umask=022 we set above, in fact, all the file folder permissions are set to 755, which for users with wine, is not a good news, then we set fmask and Dmask respectively.

# mount-t Ntfs-3g-o Uid=username,gid=users,fmask=133,dmask=022/dev/sdb1/mnt/data
As a result, we finally get the file permission is 644, the folder permission is 755, above writes in the fstab to be mounted on the word, is this:

/dev/sdb1/mnt/data ntfs-3g uid=username,gid=users,fmask=133,dmask=022 0 0
Appendix
Sugo S, representing the suid, GUID, sticky and suid, GUID, sticky, respectively, 4, 2, to represent the relevant permissions.

That

Suid+guid+sticky and representation of the
4 + 2 + 1 7 suid + GUID + sticky
4 + 2 + 0 6 suid + GUID
4 + 0 + 1 5 suid + sticky
4 + 0 + 0 4 suid
0 + 2 + 1 3 GUID + sticky
0 + 2 + 0 2 GUID
0 + 0 + 1 1 sticky
0 + 0 + 0 0 No
Many people have mentioned that/etc/shadow is the root of read and write, ordinary users can also use passwd to change the reason for their password.

SUID: Only on executables, when other users run the file, they temporarily own the file owner's permissions
Sgid: Can function on a directory or executable file, and also, temporarily owning the permissions of the file or folder owner
Sticky: Only function in the directory, can be used to prevent deletion, once owned sticky property is, in addition to the directory owner and Root, no one else can delete the directory of files or subdirectories.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.