Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi, I'm running Redhat 7.3 and I recently mounted my windows ntfs partition into linux. My problem is, only root can access it, and I want my user account (uid 500) to have read access to it as well. When I try to open the directory where I've got it mounted with my user account though it says I don't have permission to access it. To fix it I first tried changing the permissions on the mount point directory to 444, but whenever I mounted the ntfs partition the permissions on that directory would always revert to 101 for some reason. It also won't let me change the permissions for the duration of the time that the partition is mounted, so I am unable to change them back unless I unmount it and that does me no good (I think because I installed only the module for read access in ntfs. I hear write access is really bad for ntfs so I can't install that if that is the problem). Next I tried changing the permissions on /dev/hda1 (the ntfs partition), but that didn't work either. Then I ran linuxconf and tried mounting it with that; it put mount -o ro,uid=500,gid=500,umask=444 in /etc/fstab, but I've rebooted several times since and also tried mounting it myself with those options and I still don't have access to the mount point with my user account.
Otherwise ntfs read support works perfectly when I'm logged in as root. I just installed linux for the first time wednesday so I don't really know what I'm doing. Does anybody know what I need to do to get this working?
What does the 333 mean? Better yet, how do you know what to use there? When I checked the man pages, it eventually pointed me to chmod. And the section in there on umask and the "octal" crap just doesn't make any sense to me. Can you put it in sort of 'laymen's terms' for me?
masterc, try reading some books and stuff, that's what they are there for. it's pretty easy really.
The second digit selects
permissions for the user who owns the file: read (4),
write (2), and execute (1); the third selects permissions
for other users in the file's group, with the same values;
and the fourth for other users not in the file's group,
with the same values.
so therefore a umask of 333 equates to a chmod of 444 (777-333) which is r--r--r-- in more conventional terms. umask 022 would be rwxr-xr-x (chmod 755) and so on.
MasterC, let's do an example. Take the three digit octal number 754. The 7 is for the permissions of the owner. The 5 and 4 are for the group and others respectively. We can convert this number easily from octal to binary so that we can figure out the permissions. Below is a table to convert one octal digit to binary:
Take the 7 in 754. It is 111 binary. Each bit of the binary number represents a permission. The sequence is rwx. So, if we look at 111, we see the first bit on the left is a one, so the owner has read permission. The middle bit is a one, so the owner has write permission. And the bit on the right is a one so the owner has execute permission.
Let's look at the 5. It's 101 binary. So, the group would have read and execute permissions, but no write permission because the middle bit is a zero.
The 4 is 100 binary. In this case, the others have only read permission and no write or execute permissions because the middle and right bits are zeroes.
To figure out what a umask number means you need to XOR ( exclusive OR ) it with 777. You can also just subtract it. You get the same results. So, 777 minus 333 is 444. Now we take the 444 and convert each digit to binary ( 100 100 100 ) and we see that the owner, group, and the others all have read permissions and no write and execute.
Alright, I'm back. I don't really know much about linux since I just started on wednesday but I really don't understand this. I tried that umask=333 thing, and that caused the permissions on the mount point directory to revert to 040 when the ntfs partition was mounted, as opposed to the 101 it would revert to when I tried umask=444. I thought 040 should work because it would allow the group access to the directory but it didn't, and I'm not sure why. The file owner was the user account though, and since the owner doesn't have access with 040 maybe that's why. Anyway I decided to try a few more random umask numbers and they would always give me seemingly random file permission numbers. After a couple minutes I finally found a few that give me what I want: umask=000, 020, 002, 022, 130, 530, and 640 all cause the directory to change to 555 once the partition is mounted and allow me to get in. There's probably something going on here and I'm just not smart enough to see it, but at least I can get with my user account now. Thank you for your help.
Edit: Oh ok, I just read your description on how umask works. I'm not sure I completely understand the last part about the exclusive or but I'm sure it at least accounts for what I found. I thougth that umask took numbers just like chmod but I guess not. Thank you for all your help again.
Wow, that was a helleva explanation, thank you for the depth of the answer. I will have to print this one out and stick it in the folder of "ultimate knowledge" that I have gathered from this site. Thanks alot!
I just noticed that I left something out. The number 754 was to be used with the chmod command. If you wanted to give the same permissions using umask, you would subtract 754 from 777 and get 023. So, it would be umask=023. Sorry about the omission.