Ubuntuでumaskが002だった。

使っているバージョンは「Ubuntu 12.04.2 LTS」です。

とあるきっかけで、作ったファイルのパーミッションが664なことに気がつき、たしかデフォルトのumaskが022だったはずで、それなら644になるはずだと思って調べてみました。

結果から言うと、直接の原因となっている場所は「/etc/login.defs」の中のここ。

216 #
217 # Enable setting of the umask group bits to be the same as owner bits
218 # (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is
219 # the same as gid, and username is the same as the primary group name.
220 #
221 # If set to yes, userdel will remove the user´s group if it contains no
222 # more members, and useradd will create by default a group with the name
223 # of the user.
224 #
225 USERGROUPS_ENAB yes

で、元になる値があるのは同ファイルのここ。

126 #
127 # Login configuration initializations:
128 #
129 #   ERASECHAR   Terminal ERASE character ('\010' = backspace).
130 #   KILLCHAR    Terminal KILL character ('\025' = CTRL/U).
131 #   UMASK       Default "umask" value.
132 #
133 # The ERASECHAR and KILLCHAR are used only on System V machines.
134 #
135 # UMASK is the default umask value for pam_umask and is used by
136 # useradd and newusers to set the mode of the new home directories.
137 # 022 is the "historical" value in Debian for UMASK
138 # 027, or even 077, could be considered better for privacy
139 # There is no One True Answer here : each sysadmin must make up his/her
140 # mind.
141 #
142 # If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value
143 # for private user groups, i. e. the uid is the same as gid, and username is
144 # the same as the primary group name: for these, the user permissions will be
145 # used as group permissions, e. g. 022 will become 002.
146 #
147 # Prefix these values with "0" to get octal, "0x" to get hexadecimal.
148 #
149 ERASECHAR   0177
150 KILLCHAR    025
151 UMASK       022

原因が分かってスッキリ!

タイトルとURLをコピーしました