What is umask in Linux [on hold]
Clash Royale CLAN TAG#URR8PPP
up vote
-6
down vote
favorite
Trying to understand what is umask in Bash-scripting, I went to man bash
and searched "umask". I found these entries, for starters:
the file creation mode mask as set by umask or inherited from the shell's parent
and:
umask [-p] [-S] [mode]
The user file-creation mask is set to mode. If mode begins with a digit, it is interpreted as an octal number; otherwise
it is interpreted as a symbolic mode mask similar to that accepted by
chmod(1).
I understand that umask
as a shell built-in command that changes some particular default permissions mode of newly created files by executing some predefined bit mask (or just "mask") somehow.
I executed umask
and got 0000
. I tried to execute umask 0600
and then umask
returned 0600
but I can't see how it effects my system, hence I'm not sure what "mode" means here.
Before I try to understand how umask works technically, it is important to me to understand the concept of umask in Linux in general.
What is the "mode" that is changed for newly created files? In other words, it doesn't seem to me to be their permissions I change with chmod
(dirs and regular files are created with their default permissions either way - umask 0000
or umask 0600
) so what default permissions change exactly?
shell umask terminology
put on hold as unclear what you're asking by JdeBP, Jeff Schaller, thrig, mosvy, JigglyNaga yesterday
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
 |Â
show 3 more comments
up vote
-6
down vote
favorite
Trying to understand what is umask in Bash-scripting, I went to man bash
and searched "umask". I found these entries, for starters:
the file creation mode mask as set by umask or inherited from the shell's parent
and:
umask [-p] [-S] [mode]
The user file-creation mask is set to mode. If mode begins with a digit, it is interpreted as an octal number; otherwise
it is interpreted as a symbolic mode mask similar to that accepted by
chmod(1).
I understand that umask
as a shell built-in command that changes some particular default permissions mode of newly created files by executing some predefined bit mask (or just "mask") somehow.
I executed umask
and got 0000
. I tried to execute umask 0600
and then umask
returned 0600
but I can't see how it effects my system, hence I'm not sure what "mode" means here.
Before I try to understand how umask works technically, it is important to me to understand the concept of umask in Linux in general.
What is the "mode" that is changed for newly created files? In other words, it doesn't seem to me to be their permissions I change with chmod
(dirs and regular files are created with their default permissions either way - umask 0000
or umask 0600
) so what default permissions change exactly?
shell umask terminology
put on hold as unclear what you're asking by JdeBP, Jeff Schaller, thrig, mosvy, JigglyNaga yesterday
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Why do you think that it does?
â JdeBP
2 days ago
I thinked it might be due to different names and also because I once read about it and didn't find a clear example of a difference (due to lack of background knowledge at the time)... I don't think it's worth discussing...
â JohnDoea
yesterday
You've asked twice, now, how a file creation mask is not a mask. Both times, people have asked in several ways why you think that to even be the case. You did not explain in the deleted question, and you aren't really explaining here. Do not be surprised that the repeated question gains no traction.
â JdeBP
yesterday
I think I explained it above and the explanation doesn't satisfy you; go on, downvote more and more of my questions. Very helpful and communal.
â JohnDoea
yesterday
1
The only instance of the word "file" from the quoted bash man page is "file-creation" -- you're on the wrong track by assuming that the umask command changes existing file permissions. Try it and see!
â Jeff Schaller
1 hour ago
 |Â
show 3 more comments
up vote
-6
down vote
favorite
up vote
-6
down vote
favorite
Trying to understand what is umask in Bash-scripting, I went to man bash
and searched "umask". I found these entries, for starters:
the file creation mode mask as set by umask or inherited from the shell's parent
and:
umask [-p] [-S] [mode]
The user file-creation mask is set to mode. If mode begins with a digit, it is interpreted as an octal number; otherwise
it is interpreted as a symbolic mode mask similar to that accepted by
chmod(1).
I understand that umask
as a shell built-in command that changes some particular default permissions mode of newly created files by executing some predefined bit mask (or just "mask") somehow.
I executed umask
and got 0000
. I tried to execute umask 0600
and then umask
returned 0600
but I can't see how it effects my system, hence I'm not sure what "mode" means here.
Before I try to understand how umask works technically, it is important to me to understand the concept of umask in Linux in general.
What is the "mode" that is changed for newly created files? In other words, it doesn't seem to me to be their permissions I change with chmod
(dirs and regular files are created with their default permissions either way - umask 0000
or umask 0600
) so what default permissions change exactly?
shell umask terminology
Trying to understand what is umask in Bash-scripting, I went to man bash
and searched "umask". I found these entries, for starters:
the file creation mode mask as set by umask or inherited from the shell's parent
and:
umask [-p] [-S] [mode]
The user file-creation mask is set to mode. If mode begins with a digit, it is interpreted as an octal number; otherwise
it is interpreted as a symbolic mode mask similar to that accepted by
chmod(1).
I understand that umask
as a shell built-in command that changes some particular default permissions mode of newly created files by executing some predefined bit mask (or just "mask") somehow.
I executed umask
and got 0000
. I tried to execute umask 0600
and then umask
returned 0600
but I can't see how it effects my system, hence I'm not sure what "mode" means here.
Before I try to understand how umask works technically, it is important to me to understand the concept of umask in Linux in general.
What is the "mode" that is changed for newly created files? In other words, it doesn't seem to me to be their permissions I change with chmod
(dirs and regular files are created with their default permissions either way - umask 0000
or umask 0600
) so what default permissions change exactly?
shell umask terminology
shell umask terminology
edited 21 mins ago
asked 2 days ago
JohnDoea
98730
98730
put on hold as unclear what you're asking by JdeBP, Jeff Schaller, thrig, mosvy, JigglyNaga yesterday
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as unclear what you're asking by JdeBP, Jeff Schaller, thrig, mosvy, JigglyNaga yesterday
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Why do you think that it does?
â JdeBP
2 days ago
I thinked it might be due to different names and also because I once read about it and didn't find a clear example of a difference (due to lack of background knowledge at the time)... I don't think it's worth discussing...
â JohnDoea
yesterday
You've asked twice, now, how a file creation mask is not a mask. Both times, people have asked in several ways why you think that to even be the case. You did not explain in the deleted question, and you aren't really explaining here. Do not be surprised that the repeated question gains no traction.
â JdeBP
yesterday
I think I explained it above and the explanation doesn't satisfy you; go on, downvote more and more of my questions. Very helpful and communal.
â JohnDoea
yesterday
1
The only instance of the word "file" from the quoted bash man page is "file-creation" -- you're on the wrong track by assuming that the umask command changes existing file permissions. Try it and see!
â Jeff Schaller
1 hour ago
 |Â
show 3 more comments
Why do you think that it does?
â JdeBP
2 days ago
I thinked it might be due to different names and also because I once read about it and didn't find a clear example of a difference (due to lack of background knowledge at the time)... I don't think it's worth discussing...
â JohnDoea
yesterday
You've asked twice, now, how a file creation mask is not a mask. Both times, people have asked in several ways why you think that to even be the case. You did not explain in the deleted question, and you aren't really explaining here. Do not be surprised that the repeated question gains no traction.
â JdeBP
yesterday
I think I explained it above and the explanation doesn't satisfy you; go on, downvote more and more of my questions. Very helpful and communal.
â JohnDoea
yesterday
1
The only instance of the word "file" from the quoted bash man page is "file-creation" -- you're on the wrong track by assuming that the umask command changes existing file permissions. Try it and see!
â Jeff Schaller
1 hour ago
Why do you think that it does?
â JdeBP
2 days ago
Why do you think that it does?
â JdeBP
2 days ago
I thinked it might be due to different names and also because I once read about it and didn't find a clear example of a difference (due to lack of background knowledge at the time)... I don't think it's worth discussing...
â JohnDoea
yesterday
I thinked it might be due to different names and also because I once read about it and didn't find a clear example of a difference (due to lack of background knowledge at the time)... I don't think it's worth discussing...
â JohnDoea
yesterday
You've asked twice, now, how a file creation mask is not a mask. Both times, people have asked in several ways why you think that to even be the case. You did not explain in the deleted question, and you aren't really explaining here. Do not be surprised that the repeated question gains no traction.
â JdeBP
yesterday
You've asked twice, now, how a file creation mask is not a mask. Both times, people have asked in several ways why you think that to even be the case. You did not explain in the deleted question, and you aren't really explaining here. Do not be surprised that the repeated question gains no traction.
â JdeBP
yesterday
I think I explained it above and the explanation doesn't satisfy you; go on, downvote more and more of my questions. Very helpful and communal.
â JohnDoea
yesterday
I think I explained it above and the explanation doesn't satisfy you; go on, downvote more and more of my questions. Very helpful and communal.
â JohnDoea
yesterday
1
1
The only instance of the word "file" from the quoted bash man page is "file-creation" -- you're on the wrong track by assuming that the umask command changes existing file permissions. Try it and see!
â Jeff Schaller
1 hour ago
The only instance of the word "file" from the quoted bash man page is "file-creation" -- you're on the wrong track by assuming that the umask command changes existing file permissions. Try it and see!
â Jeff Schaller
1 hour ago
 |Â
show 3 more comments
2 Answers
2
active
oldest
votes
up vote
1
down vote
In Linux the default file permission is 0644, default directory permission is 0755 and default umask is 0022.
Now, as the full permission of a file is 0666, the default permission came from (0666 - 0022 = 0644) and for directory it is (0777 - 0022 = 0755).
You can set the mask using #umask 0000
, and it will create files and directories with full 666/777 permission (which is very insecure though).
add a comment |Â
up vote
-1
down vote
umask
is used to set the mask
.
Did you mean to say it is a utility ?
â JohnDoea
yesterday
What i meant to say is you use umask command to set mask permissions.
â AsenM
yesterday
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
In Linux the default file permission is 0644, default directory permission is 0755 and default umask is 0022.
Now, as the full permission of a file is 0666, the default permission came from (0666 - 0022 = 0644) and for directory it is (0777 - 0022 = 0755).
You can set the mask using #umask 0000
, and it will create files and directories with full 666/777 permission (which is very insecure though).
add a comment |Â
up vote
1
down vote
In Linux the default file permission is 0644, default directory permission is 0755 and default umask is 0022.
Now, as the full permission of a file is 0666, the default permission came from (0666 - 0022 = 0644) and for directory it is (0777 - 0022 = 0755).
You can set the mask using #umask 0000
, and it will create files and directories with full 666/777 permission (which is very insecure though).
add a comment |Â
up vote
1
down vote
up vote
1
down vote
In Linux the default file permission is 0644, default directory permission is 0755 and default umask is 0022.
Now, as the full permission of a file is 0666, the default permission came from (0666 - 0022 = 0644) and for directory it is (0777 - 0022 = 0755).
You can set the mask using #umask 0000
, and it will create files and directories with full 666/777 permission (which is very insecure though).
In Linux the default file permission is 0644, default directory permission is 0755 and default umask is 0022.
Now, as the full permission of a file is 0666, the default permission came from (0666 - 0022 = 0644) and for directory it is (0777 - 0022 = 0755).
You can set the mask using #umask 0000
, and it will create files and directories with full 666/777 permission (which is very insecure though).
edited yesterday
JohnDoea
98730
98730
answered 2 days ago
al mamun
5519
5519
add a comment |Â
add a comment |Â
up vote
-1
down vote
umask
is used to set the mask
.
Did you mean to say it is a utility ?
â JohnDoea
yesterday
What i meant to say is you use umask command to set mask permissions.
â AsenM
yesterday
add a comment |Â
up vote
-1
down vote
umask
is used to set the mask
.
Did you mean to say it is a utility ?
â JohnDoea
yesterday
What i meant to say is you use umask command to set mask permissions.
â AsenM
yesterday
add a comment |Â
up vote
-1
down vote
up vote
-1
down vote
umask
is used to set the mask
.
umask
is used to set the mask
.
answered 2 days ago
AsenM
3817
3817
Did you mean to say it is a utility ?
â JohnDoea
yesterday
What i meant to say is you use umask command to set mask permissions.
â AsenM
yesterday
add a comment |Â
Did you mean to say it is a utility ?
â JohnDoea
yesterday
What i meant to say is you use umask command to set mask permissions.
â AsenM
yesterday
Did you mean to say it is a utility ?
â JohnDoea
yesterday
Did you mean to say it is a utility ?
â JohnDoea
yesterday
What i meant to say is you use umask command to set mask permissions.
â AsenM
yesterday
What i meant to say is you use umask command to set mask permissions.
â AsenM
yesterday
add a comment |Â
Why do you think that it does?
â JdeBP
2 days ago
I thinked it might be due to different names and also because I once read about it and didn't find a clear example of a difference (due to lack of background knowledge at the time)... I don't think it's worth discussing...
â JohnDoea
yesterday
You've asked twice, now, how a file creation mask is not a mask. Both times, people have asked in several ways why you think that to even be the case. You did not explain in the deleted question, and you aren't really explaining here. Do not be surprised that the repeated question gains no traction.
â JdeBP
yesterday
I think I explained it above and the explanation doesn't satisfy you; go on, downvote more and more of my questions. Very helpful and communal.
â JohnDoea
yesterday
1
The only instance of the word "file" from the quoted bash man page is "file-creation" -- you're on the wrong track by assuming that the umask command changes existing file permissions. Try it and see!
â Jeff Schaller
1 hour ago