Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Umask is a value set in your profile file i.e. in /etc/profile or as far as I remember somewhere in .bashrc (for bash shell) or .cshrc (c shell) or in ~/.login. It's used to set permission mode on files that you create.
Any file that you create, gets permission based on umask value set in your profile. If umask is set to 0022, then the newly created file will get permission mode of 644.
In your case, you are getting different values, because they're set in corresponding user's profiles. Root and Oracle user are getting 0022 from /etc/profile as they may not have umask set in their personal profile file.
A umask of 022 allows only you to write data, but anyone can read data....umask of 002 is for sharing data with members of the same group. Different user permissions/setup = different umasks and rights.
Thanks for your reply. I know basic umask settings. i asked by default why both user having different value ? [ it's my ques]
I was waiting for long time to get reply. Just now i got reply from here.
but i already done few testings. I am sharing here.
drwxr-xr-x 2 usr1 oinstall 4096 Jan 13 20:32 sample -rw-r--r-- 1 usr1 oinstall 740 Jan 13 20:33 sample.txt
Quote:
DIR =777 – 022 = 755 (rwxr-xr-x) and
FILE = 666-022=644 (-rw-r--r-- )
>> User(rose) with oinstall(secondary) and umask is 0002 >>
PHP Code:
# useradd -G oinstall rose usr1 umask : 0002 # mkdir sample $ touch sample.txt $ ls -ld sample sample.txt
PHP Code:
drwxrwxr-x 2 rose rose 4096 Jan 13 20:38 sample -rw-rw-r-- 1 rose rose 680 Jan 13 20:40 sample.txt
Quote:
DIR =777 – 002 = 775 (rwxrwxr-x) and FILE = 666-022=644 (-rw-rw-r-- )
Why i posted this .. A
usr1 added with primary (-g) oinstall group so umask is 0022
rose user added with secondery (-G) oinstall group so umask is 0002.
Even rose user with oinstall group , o/p showing group name is "ROSE".please see 2nd o/p. Please reply am i right ? i am not a linux guy i belong oracle background. i need clarification for what i posted above output. Please reply ... Expecting reply .......
Hi tbone ;
Thanks for your reply. I know basic umask settings. i asked by default why both user having different value ? it's my ques.
If you already know what umask is, then that answers your question. Again, the umasks will vary, depending on how the user was set up, and what permissions that user has, simple as that.
Quote:
I was waiting for long time to get reply. Just now i got reply from here.
"Long time"?? Less than 24 hours...if you need a faster answer, then you need to have a version of Linux with paid-for tech support (like Red Hat Enterprise or SuSE Enterprise), and call them. Otherwise, it's fairly rude to say things like "I was waiting for long time", on a VOLUNTEER forum.
Quote:
but i already done few testings. I am sharing here.
Why i posted this. A usr1 added with primary (-g) oinstall group so umask is 0022
rose user added with secondery (-G) oinstall group so umask is 0002.
Eve n rose user with oinstall group, o/p showing group name is "ROSE". please see 2nd o/p.
Please reply am i right ? i am not a linux guy i belong oracle background. i need clarification for what i posted above output.
Please reply ... Expecting reply .......
Again, such things are fairly rude on a volunteer forum.
AGAIN...different user setups = different umasks. Doesn't get much simpler than that. Again, read the explanations/descriptions of umask that were given to you. If you're not a Linux guy, you should be able to ask your Linux administrators at your organization if you have further questions, or you don't understand the umask documentation that was given to you previously.
I asked clarification for my doubts.
What mistake i made ? Yes., you are discouraging me !
I had some doubts, i need clarification so that i posted.
Unix team is different , Oracle tam is different.
Every time , i can't ask my doubts to unix team.
If you ask what is umask ?.. i can explain Everything ..
If i post anything wrong ! I am sorry !! but you did n't answer to my question.
Hello TBone ;
I asked clarification for my doubts.
What mistake i made ? Yes., you are discouraging me !
What mistakes?? Did you not read what was posted?? You complained about having to wait a long time, then told us you were EXPECTING a reply. Sorry, but your question was answered within 24 hours, and (as VOLUNTEERS), you don't 'expect' anything from us. And if someone telling you you're being rude is 'discouraging', that's not a problem anyone else can fix but you.
Quote:
I had some doubts, i need clarification so that i posted. Unix team is different , Oracle tam is different. Every time , i can't ask my doubts to unix team.
The word "doubt" and the word "question" have different meanings. And yes, I realize they are different teams...but they are YOUR COWORKERS. If you have questions, you should be able to talk to each other.
Quote:
If you ask what is umask ?.. i can explain Everything ..
Then why are you asking a question about why umasks are different?
Quote:
If i post anything wrong ! I am sorry !! but you did n't answer to my question.
I answered your question several times. It appears you aren't understanding the answer.
AGAIN...if you set up users differently, they will have different settings. Period...that's it. That's your answer. Different primary groups = different inherited umasks. AGAIN...see the documentation on umask, since that explains things in greater detail.
-g option is used to specify primary group of the user when you create it. -G option is used to specify secondary or any alternative group of the user when you create it.
When you use -g option with useradd, it adds "oinstall" or whichever group you specified with it, as primary group for that user (let's say testuser). And when that user creates any new file, let's say sample.txt, then the file by default gets that user's primary group i.e. oinstall or whichever it is.
Just have a look:-
Code:
~$ useradd -g oinstall testuser
~$ su - testuser
~$ touch sample.txt
~$ ls -la sample.txt
------ testuser oinstall sample.txt
On the other hand, when you use -G option with useradd, it add "oinstall" or whichever group you specified with it, as secondary/alternative group for that user.
FYI, oinstall is a group used by those who manage databases. So when you set "oinstall" as primary group, it sets umask to 0022 for that user, so any new file created by that user can get 644 permission. Point to note here, 6 stands for owner, 4 stands for group and 4 stands for others respectively. This means, group member of "oinstall" can also have write permission on that file.
If a user do not have "oinstall" as primary group, then he will not get write permission on that database file, that's why he has umask 0002.
Hope it will clear your doubts.
If you still have any doubts, once go through manual of useradd and chmod.
Code:
~$ man useradd
~$ man chmod
Quote:
I am asking concept of umask. or i am not lerning linux here.
Be assured, we're not here to teach you linux. And do not get impatience, because all here are volunteers, who spend their precious time and best efforts to help you, so just be cool
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.