精华内容
下载资源
问答
  • umask 千次阅读
    2022-02-17 19:39:31

    系统默认权限设定 
    系统本身存在的意义共享资源
    从安全角度讲系统共享的资源越少,开放的权力越小系统安全性越高
    既要保证系统安全,又要系统创造价值,于是把应该开放的权力默认开放把不安全的权力默认保留

    默认权限:

    文件默认权限 = 777-umask-111
    目录默认权限 = 777-umask 

    永久更改权限:

    vim /etc/bashrc ##shell系统配置文件

    74      if    [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
    75           umask 002                            #普通用户的umask
    76      else
    77           umask 022 -- 077                #root用户的umas

    78 fi
     

    更多相关内容
  • 起源是一道题1:如果你的umask设置为022,缺省的你创建的文件权限为? 这让我回忆起被问过的另外一道题2: 777表示什么权限? 用户组说明 -rwxrw-r‐-1 root root 1213 Feb 2 09:39 abc 第一个字符代表文件(-...
  • Linux umask命令 Linux umask命令指定在建立文件时预设的权限掩码。 umask可用来设定[权限掩码]。[权限掩码]是由3个八进制的数字所组成,将现有的存取权限减掉权限掩码后,即可产生建立文件时预设的权限。 语法umask...
  • 主要介绍了简单介绍C语言中的umask()函数和truncate()函数,是C语言入门学习中的基础知识,需要的朋友可以参考下
  • umask命令可用来设定权限掩码。权限掩码是由3个八进制的数字所组成,将现有的存取权限减掉权限掩码后,即可产生建立文件时预设的权限。 语法格式:umask [参数] [权限掩码] 常用参数: -S 以文字的方式来表示...
  • 详解linux下umask的使用

    2020-09-14 23:04:31
    主要介绍了详解linux下umask的使用,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
  • umask:000 file:666 dir:777 umask:001 file:666 dir:776 umask:002 file:664 dir:775 umask:003 file:664 dir:774 umask:004 file:662 dir:773 umask:005 file:662 dir:772 umask:006 file:660 dir:771 umask:007 ...

    umask:000 file:666 dir:777
    umask:001 file:666 dir:776
    umask:002 file:664 dir:775
    umask:003 file:664 dir:774
    umask:004 file:662 dir:773
    umask:005 file:662 dir:772
    umask:006 file:660 dir:771
    umask:007 file:660 dir:770
    umask:010 file:666 dir:767
    umask:011 file:666 dir:766
    umask:012 file:664 dir:765
    umask:013 file:664 dir:764
    umask:014 file:662 dir:763
    umask:015 file:662 dir:762
    umask:016 file:660 dir:761
    umask:017 file:660 dir:760
    umask:020 file:646 dir:757
    umask:021 file:646 dir:756
    umask:022 file:644 dir:755
    umask:023 file:644 dir:754
    umask:024 file:642 dir:753
    umask:025 file:642 dir:752
    umask:026 file:640 dir:751
    umask:027 file:640 dir:750
    umask:030 file:646 dir:747
    umask:031 file:646 dir:746
    umask:032 file:644 dir:745
    umask:033 file:644 dir:744
    umask:034 file:642 dir:743
    umask:035 file:642 dir:742
    umask:036 file:640 dir:741
    umask:037 file:640 dir:740
    umask:040 file:626 dir:737
    umask:041 file:626 dir:736
    umask:042 file:624 dir:735
    umask:043 file:624 dir:734
    umask:044 file:622 dir:733
    umask:045 file:622 dir:732
    umask:046 file:620 dir:731
    umask:047 file:620 dir:730
    umask:050 file:626 dir:727
    umask:051 file:626 dir:726
    umask:052 file:624 dir:725
    umask:053 file:624 dir:724
    umask:054 file:622 dir:723
    umask:055 file:622 dir:722
    umask:056 file:620 dir:721
    umask:057 file:620 dir:720
    umask:060 file:606 dir:717
    umask:061 file:606 dir:716
    umask:062 file:604 dir:715
    umask:063 file:604 dir:714
    umask:064 file:602 dir:713
    umask:065 file:602 dir:712
    umask:066 file:600 dir:711
    umask:067 file:600 dir:710
    umask:070 file:606 dir:707
    umask:071 file:606 dir:706
    umask:072 file:604 dir:705
    umask:073 file:604 dir:704
    umask:074 file:602 dir:703
    umask:075 file:602 dir:702
    umask:076 file:600 dir:701
    umask:077 file:600 dir:700
    umask:100 file:666 dir:677
    umask:101 file:666 dir:676
    umask:102 file:664 dir:675
    umask:103 file:664 dir:674
    umask:104 file:662 dir:673
    umask:105 file:662 dir:672
    umask:106 file:660 dir:671
    umask:107 file:660 dir:670
    umask:110 file:666 dir:667
    umask:111 file:666 dir:666
    umask:112 file:664 dir:665
    umask:113 file:664 dir:664
    umask:114 file:662 dir:663
    umask:115 file:662 dir:662
    umask:116 file:660 dir:661
    umask:117 file:660 dir:660
    umask:120 file:646 dir:657
    umask:121 file:646 dir:656
    umask:122 file:644 dir:655
    umask:123 file:644 dir:654
    umask:124 file:642 dir:653
    umask:125 file:642 dir:652
    umask:126 file:640 dir:651
    umask:127 file:640 dir:650
    umask:130 file:646 dir:647
    umask:131 file:646 dir:646
    umask:132 file:644 dir:645
    umask:133 file:644 dir:644
    umask:134 file:642 dir:643
    umask:135 file:642 dir:642
    umask:136 file:640 dir:641
    umask:137 file:640 dir:640
    umask:140 file:626 dir:637
    umask:141 file:626 dir:636
    umask:142 file:624 dir:635
    umask:143 file:624 dir:634
    umask:144 file:622 dir:633
    umask:145 file:622 dir:632
    umask:146 file:620 dir:631
    umask:147 file:620 dir:630
    umask:150 file:626 dir:627
    umask:151 file:626 dir:626
    umask:152 file:624 dir:625
    umask:153 file:624 dir:624
    umask:154 file:622 dir:623
    umask:155 file:622 dir:622
    umask:156 file:620 dir:621
    umask:157 file:620 dir:620
    umask:160 file:606 dir:617
    umask:161 file:606 dir:616
    umask:162 file:604 dir:615
    umask:163 file:604 dir:614
    umask:164 file:602 dir:613
    umask:165 file:602 dir:612
    umask:166 file:600 dir:611
    umask:167 file:600 dir:610
    umask:170 file:606 dir:607
    umask:171 file:606 dir:606
    umask:172 file:604 dir:605
    umask:173 file:604 dir:604
    umask:174 file:602 dir:603
    umask:175 file:602 dir:602
    umask:176 file:600 dir:601
    umask:177 file:600 dir:600
    umask:200 file:466 dir:577
    umask:201 file:466 dir:576
    umask:202 file:464 dir:575
    umask:203 file:464 dir:574
    umask:204 file:462 dir:573
    umask:205 file:462 dir:572
    umask:206 file:460 dir:571
    umask:207 file:460 dir:570
    umask:210 file:466 dir:567
    umask:211 file:466 dir:566
    umask:212 file:464 dir:565
    umask:213 file:464 dir:564
    umask:214 file:462 dir:563
    umask:215 file:462 dir:562
    umask:216 file:460 dir:561
    umask:217 file:460 dir:560
    umask:220 file:446 dir:557
    umask:221 file:446 dir:556
    umask:222 file:444 dir:555
    umask:223 file:444 dir:554
    umask:224 file:442 dir:553
    umask:225 file:442 dir:552
    umask:226 file:440 dir:551
    umask:227 file:440 dir:550
    umask:230 file:446 dir:547
    umask:231 file:446 dir:546
    umask:232 file:444 dir:545
    umask:233 file:444 dir:544
    umask:234 file:442 dir:543
    umask:235 file:442 dir:542
    umask:236 file:440 dir:541
    umask:237 file:440 dir:540
    umask:240 file:426 dir:537
    umask:241 file:426 dir:536
    umask:242 file:424 dir:535
    umask:243 file:424 dir:534
    umask:244 file:422 dir:533
    umask:245 file:422 dir:532
    umask:246 file:420 dir:531
    umask:247 file:420 dir:530
    umask:250 file:426 dir:527
    umask:251 file:426 dir:526
    umask:252 file:424 dir:525
    umask:253 file:424 dir:524
    umask:254 file:422 dir:523
    umask:255 file:422 dir:522
    umask:256 file:420 dir:521
    umask:257 file:420 dir:520
    umask:260 file:406 dir:517
    umask:261 file:406 dir:516
    umask:262 file:404 dir:515
    umask:263 file:404 dir:514
    umask:264 file:402 dir:513
    umask:265 file:402 dir:512
    umask:266 file:400 dir:511
    umask:267 file:400 dir:510
    umask:270 file:406 dir:507
    umask:271 file:406 dir:506
    umask:272 file:404 dir:505
    umask:273 file:404 dir:504
    umask:274 file:402 dir:503
    umask:275 file:402 dir:502
    umask:276 file:400 dir:501
    umask:277 file:400 dir:500
    umask:300 file:466 dir:477
    umask:301 file:466 dir:476
    umask:302 file:464 dir:475
    umask:303 file:464 dir:474
    umask:304 file:462 dir:473
    umask:305 file:462 dir:472
    umask:306 file:460 dir:471
    umask:307 file:460 dir:470
    umask:310 file:466 dir:467
    umask:311 file:466 dir:466
    umask:312 file:464 dir:465
    umask:313 file:464 dir:464
    umask:314 file:462 dir:463
    umask:315 file:462 dir:462
    umask:316 file:460 dir:461
    umask:317 file:460 dir:460
    umask:320 file:446 dir:457
    umask:321 file:446 dir:456
    umask:322 file:444 dir:455
    umask:323 file:444 dir:454
    umask:324 file:442 dir:453
    umask:325 file:442 dir:452
    umask:326 file:440 dir:451
    umask:327 file:440 dir:450
    umask:330 file:446 dir:447
    umask:331 file:446 dir:446
    umask:332 file:444 dir:445
    umask:333 file:444 dir:444
    umask:334 file:442 dir:443
    umask:335 file:442 dir:442
    umask:336 file:440 dir:441
    umask:337 file:440 dir:440
    umask:340 file:426 dir:437
    umask:341 file:426 dir:436
    umask:342 file:424 dir:435
    umask:343 file:424 dir:434
    umask:344 file:422 dir:433
    umask:345 file:422 dir:432
    umask:346 file:420 dir:431
    umask:347 file:420 dir:430
    umask:350 file:426 dir:427
    umask:351 file:426 dir:426
    umask:352 file:424 dir:425
    umask:353 file:424 dir:424
    umask:354 file:422 dir:423
    umask:355 file:422 dir:422
    umask:356 file:420 dir:421
    umask:357 file:420 dir:420
    umask:360 file:406 dir:417
    umask:361 file:406 dir:416
    umask:362 file:404 dir:415
    umask:363 file:404 dir:414
    umask:364 file:402 dir:413
    umask:365 file:402 dir:412
    umask:366 file:400 dir:411
    umask:367 file:400 dir:410
    umask:370 file:406 dir:407
    umask:371 file:406 dir:406
    umask:372 file:404 dir:405
    umask:373 file:404 dir:404
    umask:374 file:402 dir:403
    umask:375 file:402 dir:402
    umask:376 file:400 dir:401
    umask:377 file:400 dir:400
    umask:400 file:266 dir:377
    umask:401 file:266 dir:376
    umask:402 file:264 dir:375
    umask:403 file:264 dir:374
    umask:404 file:262 dir:373
    umask:405 file:262 dir:372
    umask:406 file:260 dir:371
    umask:407 file:260 dir:370
    umask:410 file:266 dir:367
    umask:411 file:266 dir:366
    umask:412 file:264 dir:365
    umask:413 file:264 dir:364
    umask:414 file:262 dir:363
    umask:415 file:262 dir:362
    umask:416 file:260 dir:361
    umask:417 file:260 dir:360
    umask:420 file:246 dir:357
    umask:421 file:246 dir:356
    umask:422 file:244 dir:355
    umask:423 file:244 dir:354
    umask:424 file:242 dir:353
    umask:425 file:242 dir:352
    umask:426 file:240 dir:351
    umask:427 file:240 dir:350
    umask:430 file:246 dir:347
    umask:431 file:246 dir:346
    umask:432 file:244 dir:345
    umask:433 file:244 dir:344
    umask:434 file:242 dir:343
    umask:435 file:242 dir:342
    umask:436 file:240 dir:341
    umask:437 file:240 dir:340
    umask:440 file:226 dir:337
    umask:441 file:226 dir:336
    umask:442 file:224 dir:335
    umask:443 file:224 dir:334
    umask:444 file:222 dir:333
    umask:445 file:222 dir:332
    umask:446 file:220 dir:331
    umask:447 file:220 dir:330
    umask:450 file:226 dir:327
    umask:451 file:226 dir:326
    umask:452 file:224 dir:325
    umask:453 file:224 dir:324
    umask:454 file:222 dir:323
    umask:455 file:222 dir:322
    umask:456 file:220 dir:321
    umask:457 file:220 dir:320
    umask:460 file:206 dir:317
    umask:461 file:206 dir:316
    umask:462 file:204 dir:315
    umask:463 file:204 dir:314
    umask:464 file:202 dir:313
    umask:465 file:202 dir:312
    umask:466 file:200 dir:311
    umask:467 file:200 dir:310
    umask:470 file:206 dir:307
    umask:471 file:206 dir:306
    umask:472 file:204 dir:305
    umask:473 file:204 dir:304
    umask:474 file:202 dir:303
    umask:475 file:202 dir:302
    umask:476 file:200 dir:301
    umask:477 file:200 dir:300
    umask:500 file:266 dir:277
    umask:501 file:266 dir:276
    umask:502 file:264 dir:275
    umask:503 file:264 dir:274
    umask:504 file:262 dir:273
    umask:505 file:262 dir:272
    umask:506 file:260 dir:271
    umask:507 file:260 dir:270
    umask:510 file:266 dir:267
    umask:511 file:266 dir:266
    umask:512 file:264 dir:265
    umask:513 file:264 dir:264
    umask:514 file:262 dir:263
    umask:515 file:262 dir:262
    umask:516 file:260 dir:261
    umask:517 file:260 dir:260
    umask:520 file:246 dir:257
    umask:521 file:246 dir:256
    umask:522 file:244 dir:255
    umask:523 file:244 dir:254
    umask:524 file:242 dir:253
    umask:525 file:242 dir:252
    umask:526 file:240 dir:251
    umask:527 file:240 dir:250
    umask:530 file:246 dir:247
    umask:531 file:246 dir:246
    umask:532 file:244 dir:245
    umask:533 file:244 dir:244
    umask:534 file:242 dir:243
    umask:535 file:242 dir:242
    umask:536 file:240 dir:241
    umask:537 file:240 dir:240
    umask:540 file:226 dir:237
    umask:541 file:226 dir:236
    umask:542 file:224 dir:235
    umask:543 file:224 dir:234
    umask:544 file:222 dir:233
    umask:545 file:222 dir:232
    umask:546 file:220 dir:231
    umask:547 file:220 dir:230
    umask:550 file:226 dir:227
    umask:551 file:226 dir:226
    umask:552 file:224 dir:225
    umask:553 file:224 dir:224
    umask:554 file:222 dir:223
    umask:555 file:222 dir:222
    umask:556 file:220 dir:221
    umask:557 file:220 dir:220
    umask:560 file:206 dir:217
    umask:561 file:206 dir:216
    umask:562 file:204 dir:215
    umask:563 file:204 dir:214
    umask:564 file:202 dir:213
    umask:565 file:202 dir:212
    umask:566 file:200 dir:211
    umask:567 file:200 dir:210
    umask:570 file:206 dir:207
    umask:571 file:206 dir:206
    umask:572 file:204 dir:205
    umask:573 file:204 dir:204
    umask:574 file:202 dir:203
    umask:575 file:202 dir:202
    umask:576 file:200 dir:201
    umask:577 file:200 dir:200
    umask:600 file:066 dir:177
    umask:601 file:066 dir:176
    umask:602 file:064 dir:175
    umask:603 file:064 dir:174
    umask:604 file:062 dir:173
    umask:605 file:062 dir:172
    umask:606 file:060 dir:171
    umask:607 file:060 dir:170
    umask:610 file:066 dir:167
    umask:611 file:066 dir:166
    umask:612 file:064 dir:165
    umask:613 file:064 dir:164
    umask:614 file:062 dir:163
    umask:615 file:062 dir:162
    umask:616 file:060 dir:161
    umask:617 file:060 dir:160
    umask:620 file:046 dir:157
    umask:621 file:046 dir:156
    umask:622 file:044 dir:155
    umask:623 file:044 dir:154
    umask:624 file:042 dir:153
    umask:625 file:042 dir:152
    umask:626 file:040 dir:151
    umask:627 file:040 dir:150
    umask:630 file:046 dir:147
    umask:631 file:046 dir:146
    umask:632 file:044 dir:145
    umask:633 file:044 dir:144
    umask:634 file:042 dir:143
    umask:635 file:042 dir:142
    umask:636 file:040 dir:141
    umask:637 file:040 dir:140
    umask:640 file:026 dir:137
    umask:641 file:026 dir:136
    umask:642 file:024 dir:135
    umask:643 file:024 dir:134
    umask:644 file:022 dir:133
    umask:645 file:022 dir:132
    umask:646 file:020 dir:131
    umask:647 file:020 dir:130
    umask:650 file:026 dir:127
    umask:651 file:026 dir:126
    umask:652 file:024 dir:125
    umask:653 file:024 dir:124
    umask:654 file:022 dir:123
    umask:655 file:022 dir:122
    umask:656 file:020 dir:121
    umask:657 file:020 dir:120
    umask:660 file:006 dir:117
    umask:661 file:006 dir:116
    umask:662 file:004 dir:115
    umask:663 file:004 dir:114
    umask:664 file:002 dir:113
    umask:665 file:002 dir:112
    umask:666 file:000 dir:111
    umask:667 file:000 dir:110
    umask:670 file:006 dir:107
    umask:671 file:006 dir:106
    umask:672 file:004 dir:105
    umask:673 file:004 dir:104
    umask:674 file:002 dir:103
    umask:675 file:002 dir:102
    umask:676 file:000 dir:101
    umask:677 file:000 dir:100
    umask:700 file:066 dir:077
    umask:701 file:066 dir:076
    umask:702 file:064 dir:075
    umask:703 file:064 dir:074
    umask:704 file:062 dir:073
    umask:705 file:062 dir:072
    umask:706 file:060 dir:071
    umask:707 file:060 dir:070
    umask:710 file:066 dir:067
    umask:711 file:066 dir:066
    umask:712 file:064 dir:065
    umask:713 file:064 dir:064
    umask:714 file:062 dir:063
    umask:715 file:062 dir:062
    umask:716 file:060 dir:061
    umask:717 file:060 dir:060
    umask:720 file:046 dir:057
    umask:721 file:046 dir:056
    umask:722 file:044 dir:055
    umask:723 file:044 dir:054
    umask:724 file:042 dir:053
    umask:725 file:042 dir:052
    umask:726 file:040 dir:051
    umask:727 file:040 dir:050
    umask:730 file:046 dir:047
    umask:731 file:046 dir:046
    umask:732 file:044 dir:045
    umask:733 file:044 dir:044
    umask:734 file:042 dir:043
    umask:735 file:042 dir:042
    umask:736 file:040 dir:041
    umask:737 file:040 dir:040
    umask:740 file:026 dir:037
    umask:741 file:026 dir:036
    umask:742 file:024 dir:035
    umask:743 file:024 dir:034
    umask:744 file:022 dir:033
    umask:745 file:022 dir:032
    umask:746 file:020 dir:031
    umask:747 file:020 dir:030
    umask:750 file:026 dir:027
    umask:751 file:026 dir:026
    umask:752 file:024 dir:025
    umask:753 file:024 dir:024
    umask:754 file:022 dir:023
    umask:755 file:022 dir:022
    umask:756 file:020 dir:021
    umask:757 file:020 dir:020
    umask:760 file:006 dir:017
    umask:761 file:006 dir:016
    umask:762 file:004 dir:015
    umask:763 file:004 dir:014
    umask:764 file:002 dir:013
    umask:765 file:002 dir:012
    umask:766 file:000 dir:011
    umask:767 file:000 dir:010
    umask:770 file:006 dir:007
    umask:771 file:006 dir:006
    umask:772 file:004 dir:005
    umask:773 file:004 dir:004
    umask:774 file:002 dir:003
    umask:775 file:002 dir:002
    umask:776 file:000 dir:001
    umask:777 file:000 dir:000

    展开全文
  • AIX的Umask

    2021-05-06 09:23:41
    A 什么是umask?当我们登录系统之后创建一个文件总是有一个默认权限的,那么这个权限是怎么来的呢? 这就是umask干的事情。umask设置了用户创建文件的默认权限,它与chmod的效果刚好相反,umask设置的是权限“补码”...

    A 什么是umask?

    当我们登录系统之后创建一个文件总是有一个默认权限的,那么这个权限是怎么来的呢? 这就是umask干的事情。

    umask设置了用户创建文件的默认权限,它与chmod的效果刚好相反,umask设置的是权限“补码”,而chmod设置的是文件权限码。

    一般在/etc/profile、$ [HOME]/.bash_profile或$[HOME]/.profile中设置umask值。

    你的系统管理员必须要为你设置一个合理的 umask值,以确保你创建的文件具有所希望的缺省权限,防止其他非同组用户对你的文件具有写权限。

    在已经登录之后,可以按照个人的偏好使用umask命 令来改变文件创建的缺省权限。相应的改变直到退出该shell或使用另外的umask命令之前一直有效。

    一般来说,umask命令是在 /etc /profile文件中设置的,每个用户在登录时都会引用这个文件,所以如果希望改变所有用户的umask,可以在该文件中加入相应的条目。

    如果希望永久 性地设置自己的umask值,那么就把它放在自己$HOME目录下的.profile或.bash_profile文件中。

    B 如何计算umask值

    umask 命令允许你设定文件创建时的缺省模式,对应每一类用户(文件属主、同组用户、其他用户)存在一个相应的umask值中的数字。

    对于文件来说,这一数字的最 大值分别是6。系统不允许你在创建一个文本文件时就赋予它执行权限,必须在创建后用chmod命令增加这一权限。目录则允许设置执行权限,这样针对目录来 说,umask中各个数字最大可以到7。

    该命令的一般形式为:

    umask nnn

    其中nnn为umask置000-777。

    让我们来看一些例子。

    计算出你的umask值:

    可以有几种计算umask值的方法,通过设置umask值,可以为新创建的文件和目录设置缺省权限。下表列出了与权限位相对应的umask值。

    在计算umask值时,可以针对各类用户分别在这张表中按照所需要的文件/目录创建缺省权限查找对应的umask值。

    例如,umask值002 所对应的文件和目录创建缺省权限分别为6 6 4和7 7 5。

    还有另外一种计算umask值的方法。我们只要记住umask是从权限中“拿走”相应的位即可。

    umask值与权限

    umask          文件      目录

    0             6          7

    1             6          6

    2             4          5

    3             4          4

    4             2          3

    5             2          2

    6             0          1

    7             0          0

    例如,对于umask值0 0 2,相应的文件和目录缺省创建权限是什么呢?

    第一步,我们首先写下具有全部权限的模式,即777 (所有用户都具有读、写和执行权限)。

    第二步,在下面一行按照umask值写下相应的位,在本例中是0 0 2。

    第三步,在接下来的一行中记下上面两行中没有匹配的位。这就是目录的缺省创建权限。

    稍加练习就能够记住这种方法。

    第四步,对于文件来说,在创建时不能具有文件权限,只要拿掉相应的执行权限比特即可。

    这就是上面的例子,   其中u m a s k值为0 0 2:

    1) 文件的最大权限        rwx rwx rwx      (777)

    2) umask值为0 0 2        --- --- -w-

    3) 目录权限              rwx rwx r-x        (775) 这就是目录创建缺省权限

    4) 文件权限              rw- rw- r--        (664) 这就是文件创建缺省权限

    下面是另外一个例子,假设这次u m a s k值为0 2 2:

    1) 文件的最大权限        rwx rwx rwx      (777)

    2) u m a s k值为0 2 2   --- -w- -w-

    3) 目录权限              rwx r-x r-x        (755) 这就是目录创建缺省权限

    4) 文件权限              rw- r-- r--        (644) 这就是文件创建缺省权限

    C 常用的umask值

    下表列出了一些umask值及它们所对应的目录和文件权限。

    常用的umask值及对应的文件和目录权限

    umask 值         目录         文件

    0 22                    7 5 5           6 4 4

    0 27                    7 5 0           6 4 0

    0 02                    7 7 5           6 6 4

    0 06                    7 7 1           6 6 0

    0 07                    7 7 0           6 6 0

    D umask命令如果想知道当前的umask 值,可以使用umask命令:

    $umask

    如果想要改变umask值,只要使用umask命令设置一个新的值即可:

    $ umask 002

    确认一下系统是否已经接受了新的u m a s k值:

    $umask

    002

    $touch testfile

    $ls -l testfile

    rw- rw- r--

    在使用umask命令之前一定要弄清楚到底希望具有什么样的文件/目录创建缺省权限。否则可能会得到一些非常奇怪的结果;例如,如果将umask值设置为 6 0 0,那么所创建的文件/目

    录的缺省权限就是0 6 6!

    展开全文
  • umask:000 file:666 dir:777 umask:001 file:666 dir:776 umask:002 file:664 dir:775 umask:003 file:664 dir:774 umask:004 file:662 dir:773 umask:005 file:662 dir:772 umask:006 file:660 dir:771 umask:007 ...

    账户与安全_umask与文件目录权限对照表


    umask:000 file:666 dir:777
    umask:001 file:666 dir:776
    umask:002 file:664 dir:775
    umask:003 file:664 dir:774
    umask:004 file:662 dir:773
    umask:005 file:662 dir:772
    umask:006 file:660 dir:771
    umask:007 file:660 dir:770
    umask:010 file:666 dir:767
    umask:011 file:666 dir:766
    umask:012 file:664 dir:765
    umask:013 file:664 dir:764
    umask:014 file:662 dir:763
    umask:015 file:662 dir:762
    umask:016 file:660 dir:761
    umask:017 file:660 dir:760
    umask:020 file:646 dir:757
    umask:021 file:646 dir:756
    umask:022 file:644 dir:755
    umask:023 file:644 dir:754
    umask:024 file:642 dir:753
    umask:025 file:642 dir:752
    umask:026 file:640 dir:751
    umask:027 file:640 dir:750
    umask:030 file:646 dir:747
    umask:031 file:646 dir:746
    umask:032 file:644 dir:745
    umask:033 file:644 dir:744
    umask:034 file:642 dir:743
    umask:035 file:642 dir:742
    umask:036 file:640 dir:741
    umask:037 file:640 dir:740
    umask:040 file:626 dir:737
    umask:041 file:626 dir:736
    umask:042 file:624 dir:735
    umask:043 file:624 dir:734
    umask:044 file:622 dir:733
    umask:045 file:622 dir:732
    umask:046 file:620 dir:731
    umask:047 file:620 dir:730
    umask:050 file:626 dir:727
    umask:051 file:626 dir:726
    umask:052 file:624 dir:725
    umask:053 file:624 dir:724
    umask:054 file:622 dir:723
    umask:055 file:622 dir:722
    umask:056 file:620 dir:721
    umask:057 file:620 dir:720
    umask:060 file:606 dir:717
    umask:061 file:606 dir:716
    umask:062 file:604 dir:715
    umask:063 file:604 dir:714
    umask:064 file:602 dir:713
    umask:065 file:602 dir:712
    umask:066 file:600 dir:711
    umask:067 file:600 dir:710
    umask:070 file:606 dir:707
    umask:071 file:606 dir:706
    umask:072 file:604 dir:705
    umask:073 file:604 dir:704
    umask:074 file:602 dir:703
    umask:075 file:602 dir:702
    umask:076 file:600 dir:701
    umask:077 file:600 dir:700
    umask:100 file:666 dir:677
    umask:101 file:666 dir:676
    umask:102 file:664 dir:675
    umask:103 file:664 dir:674
    umask:104 file:662 dir:673
    umask:105 file:662 dir:672
    umask:106 file:660 dir:671
    umask:107 file:660 dir:670
    umask:110 file:666 dir:667
    umask:111 file:666 dir:666
    umask:112 file:664 dir:665
    umask:113 file:664 dir:664
    umask:114 file:662 dir:663
    umask:115 file:662 dir:662
    umask:116 file:660 dir:661
    umask:117 file:660 dir:660
    umask:120 file:646 dir:657
    umask:121 file:646 dir:656
    umask:122 file:644 dir:655
    umask:123 file:644 dir:654
    umask:124 file:642 dir:653
    umask:125 file:642 dir:652
    umask:126 file:640 dir:651
    umask:127 file:640 dir:650
    umask:130 file:646 dir:647
    umask:131 file:646 dir:646
    umask:132 file:644 dir:645
    umask:133 file:644 dir:644
    umask:134 file:642 dir:643
    umask:135 file:642 dir:642
    umask:136 file:640 dir:641
    umask:137 file:640 dir:640
    umask:140 file:626 dir:637
    umask:141 file:626 dir:636
    umask:142 file:624 dir:635
    umask:143 file:624 dir:634
    umask:144 file:622 dir:633
    umask:145 file:622 dir:632
    umask:146 file:620 dir:631
    umask:147 file:620 dir:630
    umask:150 file:626 dir:627
    umask:151 file:626 dir:626
    umask:152 file:624 dir:625
    umask:153 file:624 dir:624
    umask:154 file:622 dir:623
    umask:155 file:622 dir:622
    umask:156 file:620 dir:621
    umask:157 file:620 dir:620
    umask:160 file:606 dir:617
    umask:161 file:606 dir:616
    umask:162 file:604 dir:615
    umask:163 file:604 dir:614
    umask:164 file:602 dir:613
    umask:165 file:602 dir:612
    umask:166 file:600 dir:611
    umask:167 file:600 dir:610
    umask:170 file:606 dir:607
    umask:171 file:606 dir:606
    umask:172 file:604 dir:605
    umask:173 file:604 dir:604
    umask:174 file:602 dir:603
    umask:175 file:602 dir:602
    umask:176 file:600 dir:601
    umask:177 file:600 dir:600
    umask:200 file:466 dir:577
    umask:201 file:466 dir:576
    umask:202 file:464 dir:575
    umask:203 file:464 dir:574
    umask:204 file:462 dir:573
    umask:205 file:462 dir:572
    umask:206 file:460 dir:571
    umask:207 file:460 dir:570
    umask:210 file:466 dir:567
    umask:211 file:466 dir:566
    umask:212 file:464 dir:565
    umask:213 file:464 dir:564
    umask:214 file:462 dir:563
    umask:215 file:462 dir:562
    umask:216 file:460 dir:561
    umask:217 file:460 dir:560
    umask:220 file:446 dir:557
    umask:221 file:446 dir:556
    umask:222 file:444 dir:555
    umask:223 file:444 dir:554
    umask:224 file:442 dir:553
    umask:225 file:442 dir:552
    umask:226 file:440 dir:551
    umask:227 file:440 dir:550
    umask:230 file:446 dir:547
    umask:231 file:446 dir:546
    umask:232 file:444 dir:545
    umask:233 file:444 dir:544
    umask:234 file:442 dir:543
    umask:235 file:442 dir:542
    umask:236 file:440 dir:541
    umask:237 file:440 dir:540
    umask:240 file:426 dir:537
    umask:241 file:426 dir:536
    umask:242 file:424 dir:535
    umask:243 file:424 dir:534
    umask:244 file:422 dir:533
    umask:245 file:422 dir:532
    umask:246 file:420 dir:531
    umask:247 file:420 dir:530
    umask:250 file:426 dir:527
    umask:251 file:426 dir:526
    umask:252 file:424 dir:525
    umask:253 file:424 dir:524
    umask:254 file:422 dir:523
    umask:255 file:422 dir:522
    umask:256 file:420 dir:521
    umask:257 file:420 dir:520
    umask:260 file:406 dir:517
    umask:261 file:406 dir:516
    umask:262 file:404 dir:515
    umask:263 file:404 dir:514
    umask:264 file:402 dir:513
    umask:265 file:402 dir:512
    umask:266 file:400 dir:511
    umask:267 file:400 dir:510
    umask:270 file:406 dir:507
    umask:271 file:406 dir:506
    umask:272 file:404 dir:505
    umask:273 file:404 dir:504
    umask:274 file:402 dir:503
    umask:275 file:402 dir:502
    umask:276 file:400 dir:501
    umask:277 file:400 dir:500
    umask:300 file:466 dir:477
    umask:301 file:466 dir:476
    umask:302 file:464 dir:475
    umask:303 file:464 dir:474
    umask:304 file:462 dir:473
    umask:305 file:462 dir:472
    umask:306 file:460 dir:471
    umask:307 file:460 dir:470
    umask:310 file:466 dir:467
    umask:311 file:466 dir:466
    umask:312 file:464 dir:465
    umask:313 file:464 dir:464
    umask:314 file:462 dir:463
    umask:315 file:462 dir:462
    umask:316 file:460 dir:461
    umask:317 file:460 dir:460
    umask:320 file:446 dir:457
    umask:321 file:446 dir:456
    umask:322 file:444 dir:455
    umask:323 file:444 dir:454
    umask:324 file:442 dir:453
    umask:325 file:442 dir:452
    umask:326 file:440 dir:451
    umask:327 file:440 dir:450
    umask:330 file:446 dir:447
    umask:331 file:446 dir:446
    umask:332 file:444 dir:445
    umask:333 file:444 dir:444
    umask:334 file:442 dir:443
    umask:335 file:442 dir:442
    umask:336 file:440 dir:441
    umask:337 file:440 dir:440
    umask:340 file:426 dir:437
    umask:341 file:426 dir:436
    umask:342 file:424 dir:435
    umask:343 file:424 dir:434
    umask:344 file:422 dir:433
    umask:345 file:422 dir:432
    umask:346 file:420 dir:431
    umask:347 file:420 dir:430
    umask:350 file:426 dir:427
    umask:351 file:426 dir:426
    umask:352 file:424 dir:425
    umask:353 file:424 dir:424
    umask:354 file:422 dir:423
    umask:355 file:422 dir:422
    umask:356 file:420 dir:421
    umask:357 file:420 dir:420
    umask:360 file:406 dir:417
    umask:361 file:406 dir:416
    umask:362 file:404 dir:415
    umask:363 file:404 dir:414
    umask:364 file:402 dir:413
    umask:365 file:402 dir:412
    umask:366 file:400 dir:411
    umask:367 file:400 dir:410
    umask:370 file:406 dir:407
    umask:371 file:406 dir:406
    umask:372 file:404 dir:405
    umask:373 file:404 dir:404
    umask:374 file:402 dir:403
    umask:375 file:402 dir:402
    umask:376 file:400 dir:401
    umask:377 file:400 dir:400
    umask:400 file:266 dir:377
    umask:401 file:266 dir:376
    umask:402 file:264 dir:375
    umask:403 file:264 dir:374
    umask:404 file:262 dir:373
    umask:405 file:262 dir:372
    umask:406 file:260 dir:371
    umask:407 file:260 dir:370
    umask:410 file:266 dir:367
    umask:411 file:266 dir:366
    umask:412 file:264 dir:365
    umask:413 file:264 dir:364
    umask:414 file:262 dir:363
    umask:415 file:262 dir:362
    umask:416 file:260 dir:361
    umask:417 file:260 dir:360
    umask:420 file:246 dir:357
    umask:421 file:246 dir:356
    umask:422 file:244 dir:355
    umask:423 file:244 dir:354
    umask:424 file:242 dir:353
    umask:425 file:242 dir:352
    umask:426 file:240 dir:351
    umask:427 file:240 dir:350
    umask:430 file:246 dir:347
    umask:431 file:246 dir:346
    umask:432 file:244 dir:345
    umask:433 file:244 dir:344
    umask:434 file:242 dir:343
    umask:435 file:242 dir:342
    umask:436 file:240 dir:341
    umask:437 file:240 dir:340
    umask:440 file:226 dir:337
    umask:441 file:226 dir:336
    umask:442 file:224 dir:335
    umask:443 file:224 dir:334
    umask:444 file:222 dir:333
    umask:445 file:222 dir:332
    umask:446 file:220 dir:331
    umask:447 file:220 dir:330
    umask:450 file:226 dir:327
    umask:451 file:226 dir:326
    umask:452 file:224 dir:325
    umask:453 file:224 dir:324
    umask:454 file:222 dir:323
    umask:455 file:222 dir:322
    umask:456 file:220 dir:321
    umask:457 file:220 dir:320
    umask:460 file:206 dir:317
    umask:461 file:206 dir:316
    umask:462 file:204 dir:315
    umask:463 file:204 dir:314
    umask:464 file:202 dir:313
    umask:465 file:202 dir:312
    umask:466 file:200 dir:311
    umask:467 file:200 dir:310
    umask:470 file:206 dir:307
    umask:471 file:206 dir:306
    umask:472 file:204 dir:305
    umask:473 file:204 dir:304
    umask:474 file:202 dir:303
    umask:475 file:202 dir:302
    umask:476 file:200 dir:301
    umask:477 file:200 dir:300
    umask:500 file:266 dir:277
    umask:501 file:266 dir:276
    umask:502 file:264 dir:275
    umask:503 file:264 dir:274
    umask:504 file:262 dir:273
    umask:505 file:262 dir:272
    umask:506 file:260 dir:271
    umask:507 file:260 dir:270
    umask:510 file:266 dir:267
    umask:511 file:266 dir:266
    umask:512 file:264 dir:265
    umask:513 file:264 dir:264
    umask:514 file:262 dir:263
    umask:515 file:262 dir:262
    umask:516 file:260 dir:261
    umask:517 file:260 dir:260
    umask:520 file:246 dir:257
    umask:521 file:246 dir:256
    umask:522 file:244 dir:255
    umask:523 file:244 dir:254
    umask:524 file:242 dir:253
    umask:525 file:242 dir:252
    umask:526 file:240 dir:251
    umask:527 file:240 dir:250
    umask:530 file:246 dir:247
    umask:531 file:246 dir:246
    umask:532 file:244 dir:245
    umask:533 file:244 dir:244
    umask:534 file:242 dir:243
    umask:535 file:242 dir:242
    umask:536 file:240 dir:241
    umask:537 file:240 dir:240
    umask:540 file:226 dir:237
    umask:541 file:226 dir:236
    umask:542 file:224 dir:235
    umask:543 file:224 dir:234
    umask:544 file:222 dir:233
    umask:545 file:222 dir:232
    umask:546 file:220 dir:231
    umask:547 file:220 dir:230
    umask:550 file:226 dir:227
    umask:551 file:226 dir:226
    umask:552 file:224 dir:225
    umask:553 file:224 dir:224
    umask:554 file:222 dir:223
    umask:555 file:222 dir:222
    umask:556 file:220 dir:221
    umask:557 file:220 dir:220
    umask:560 file:206 dir:217
    umask:561 file:206 dir:216
    umask:562 file:204 dir:215
    umask:563 file:204 dir:214
    umask:564 file:202 dir:213
    umask:565 file:202 dir:212
    umask:566 file:200 dir:211
    umask:567 file:200 dir:210
    umask:570 file:206 dir:207
    umask:571 file:206 dir:206
    umask:572 file:204 dir:205
    umask:573 file:204 dir:204
    umask:574 file:202 dir:203
    umask:575 file:202 dir:202
    umask:576 file:200 dir:201
    umask:577 file:200 dir:200
    umask:600 file:066 dir:177
    umask:601 file:066 dir:176
    umask:602 file:064 dir:175
    umask:603 file:064 dir:174
    umask:604 file:062 dir:173
    umask:605 file:062 dir:172
    umask:606 file:060 dir:171
    umask:607 file:060 dir:170
    umask:610 file:066 dir:167
    umask:611 file:066 dir:166
    umask:612 file:064 dir:165
    umask:613 file:064 dir:164
    umask:614 file:062 dir:163
    umask:615 file:062 dir:162
    umask:616 file:060 dir:161
    umask:617 file:060 dir:160
    umask:620 file:046 dir:157
    umask:621 file:046 dir:156
    umask:622 file:044 dir:155
    umask:623 file:044 dir:154
    umask:624 file:042 dir:153
    umask:625 file:042 dir:152
    umask:626 file:040 dir:151
    umask:627 file:040 dir:150
    umask:630 file:046 dir:147
    umask:631 file:046 dir:146
    umask:632 file:044 dir:145
    umask:633 file:044 dir:144
    umask:634 file:042 dir:143
    umask:635 file:042 dir:142
    umask:636 file:040 dir:141
    umask:637 file:040 dir:140
    umask:640 file:026 dir:137
    umask:641 file:026 dir:136
    umask:642 file:024 dir:135
    umask:643 file:024 dir:134
    umask:644 file:022 dir:133
    umask:645 file:022 dir:132
    umask:646 file:020 dir:131
    umask:647 file:020 dir:130
    umask:650 file:026 dir:127
    umask:651 file:026 dir:126
    umask:652 file:024 dir:125
    umask:653 file:024 dir:124
    umask:654 file:022 dir:123
    umask:655 file:022 dir:122
    umask:656 file:020 dir:121
    umask:657 file:020 dir:120
    umask:660 file:006 dir:117
    umask:661 file:006 dir:116
    umask:662 file:004 dir:115
    umask:663 file:004 dir:114
    umask:664 file:002 dir:113
    umask:665 file:002 dir:112
    umask:666 file:000 dir:111
    umask:667 file:000 dir:110
    umask:670 file:006 dir:107
    umask:671 file:006 dir:106
    umask:672 file:004 dir:105
    umask:673 file:004 dir:104
    umask:674 file:002 dir:103
    umask:675 file:002 dir:102
    umask:676 file:000 dir:101
    umask:677 file:000 dir:100
    umask:700 file:066 dir:077
    umask:701 file:066 dir:076
    umask:702 file:064 dir:075
    umask:703 file:064 dir:074
    umask:704 file:062 dir:073
    umask:705 file:062 dir:072
    umask:706 file:060 dir:071
    umask:707 file:060 dir:070
    umask:710 file:066 dir:067
    umask:711 file:066 dir:066
    umask:712 file:064 dir:065
    umask:713 file:064 dir:064
    umask:714 file:062 dir:063
    umask:715 file:062 dir:062
    umask:716 file:060 dir:061
    umask:717 file:060 dir:060
    umask:720 file:046 dir:057
    umask:721 file:046 dir:056
    umask:722 file:044 dir:055
    umask:723 file:044 dir:054
    umask:724 file:042 dir:053
    umask:725 file:042 dir:052
    umask:726 file:040 dir:051
    umask:727 file:040 dir:050
    umask:730 file:046 dir:047
    umask:731 file:046 dir:046
    umask:732 file:044 dir:045
    umask:733 file:044 dir:044
    umask:734 file:042 dir:043
    umask:735 file:042 dir:042
    umask:736 file:040 dir:041
    umask:737 file:040 dir:040
    umask:740 file:026 dir:037
    umask:741 file:026 dir:036
    umask:742 file:024 dir:035
    umask:743 file:024 dir:034
    umask:744 file:022 dir:033
    umask:745 file:022 dir:032
    umask:746 file:020 dir:031
    umask:747 file:020 dir:030
    umask:750 file:026 dir:027
    umask:751 file:026 dir:026
    umask:752 file:024 dir:025
    umask:753 file:024 dir:024
    umask:754 file:022 dir:023
    umask:755 file:022 dir:022
    umask:756 file:020 dir:021
    umask:757 file:020 dir:020
    umask:760 file:006 dir:017
    umask:761 file:006 dir:016
    umask:762 file:004 dir:015
    umask:763 file:004 dir:014
    umask:764 file:002 dir:013
    umask:765 file:002 dir:012
    umask:766 file:000 dir:011
    umask:767 file:000 dir:010
    umask:770 file:006 dir:007
    umask:771 file:006 dir:006
    umask:772 file:004 dir:005
    umask:773 file:004 dir:004
    umask:774 file:002 dir:003
    umask:775 file:002 dir:002
    umask:776 file:000 dir:001
    umask:777 file:000 dir:000

    展开全文
  • LINUX UMASK详解

    2021-05-16 11:17:06
    一 权限掩码umaskumask是chmod配套的,总共为4位(gid/uid,属主,组权,其它用户的权限),不过通常...umask的作用默认情况下的umask值是022(可以用umask命令查看),此时你建立的文件默认权限是644(6-0,6-2,6-2),建立...
  • [转载]linux umask函数

    2021-05-15 02:33:07
    语 法:umask [-S][权限掩码]补充说明:umask可用来设定[权限掩码]。[权限掩码]是由3个八进制的数字所组成,将现有的存取权限减掉权限掩码后,即可产生建立文件时预设的权限。参 数:-S 以文字的方式来表示权限...
  • linux配置修改umask

    千次阅读 2022-01-31 16:21:00
    linux配置修改umask 在Linux系统中umask值代表的是我们创建新文件/目录的默认权限设置,系统root账号默认的umask的值为0022 普通账号的umask的值为0002 查看umask值 使用命令umask命令可以查看当前帐号umask的值 ...
  • 一、文件权限查看及读取 1.文件权限 文件权限存在的意义 系统最底层安全设定方法之一 保证文件可以被可用的用户做相应操作 2.文件权限的查看 ls -l file ##查看文件权限 ls -ld dir ##查看目录权限 ...
  • umask 命令返回或设置系统文件模式创建掩码的值。 umask 命令语法 用法: umask [-p] [-S] [mode] 用户文件创建掩码设置为模式。如果 mode 以数字开头,则将其解释为八进制数; 否则,它被解释为类似于 chmod...
  • umask详解

    千次阅读 多人点赞 2019-11-19 21:32:19
    一、umask介绍 在linux系统中,我们创建一个新的文件或者目录的时候,这些新的文件或目录都会有默认的访问权限,umask命令与文件和目录的默认访问权限有关。若用户创建一个文件,则文件的默认访问权限为 -rw-rw...
  • Linux 的umask详解

    千次阅读 2021-05-16 11:37:03
    1.由权限得到umask的值umask是一个系统变量,是一个由3个八进制数字组成的值,具体含义见表;每个数字都是八进制值1、2、4的OR操作结果。作用:当文件被创建时,为文件的访问权限设定一个掩码。执行umask命令可以...
  • umask实用程序允许您查看或设置文件模式创建掩码,该掩码确定新创建的文件或目录的权限。mkdir、touch、tee和其他创建新文件和目录的命令都使用它。Linux权限在进一步讨论之前,让我们简要介绍一下Linux权限模式。...
  • linux常用命令。
  • linux系统umask值及其对应的文件权限

    千次阅读 2021-05-11 22:56:15
    linux系统umask值及其对应的文件权限1)简单好用的加减法计算文件权限计算小结论:创建文件默认最大权限为666(-rw-rw-rw-),默认创建的文件没有可执行权限x位。对于文件来说,umask的设置是在假定文件拥有八进制666的...
  • Linux ❉ mask和umask详解

    2022-01-17 13:02:04
    mask和umask详解

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 80,711
精华内容 32,284
关键字:

umask