标签:三种权限 systemd 授权 conf before defs 使用 失效 systems
0:超级管理员
1-999:系统用户(包含Linux中自带服务)
1000以上 普通用户
Root用户 (ID 0)超级管理员
系统用户 (ID 1-499)
普通用户 (ID 500以上)
/etc/passwd 保存用户信息
[root@localhost ~]# cat /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin dbus:x:81:81:System message bus:/:/sbin/nologin polkitd:x:999:998:User for polkitd:/:/sbin/nologin libstoragemgmt:x:998:997:daemon account for libstoragemgmt:/var/run/lsm:/sbin/nologin abrt:x:173:173::/etc/abrt:/sbin/nologin rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin postfix:x:89:89::/var/spool/postfix:/sbin/nologin ntp:x:38:38::/etc/ntp:/sbin/nologin chrony:x:997:995::/var/lib/chrony:/sbin/nologin tcpdump:x:72:72::/:/sbin/nologin quail:x:1000:1000:quail:/home/quail:/bin/bash
/etc/shadow 保存用户密码(以加密形式保存)
[root@localhost ~]# cat /etc/shadow root:$6$ONr1v9vJOt8CnljA$xyqJy3PJUyDP7CIfUheuSa1MWjISSr4KRi.AHIEw8DCdVYQa36HjJ5TkFYnRinoiOu.kvmRKFs43HfMXz4UQi1::0:99999:7::: bin:*:17834:0:99999:7::: daemon:*:17834:0:99999:7::: adm:*:17834:0:99999:7::: lp:*:17834:0:99999:7::: sync:*:17834:0:99999:7::: shutdown:*:17834:0:99999:7::: halt:*:17834:0:99999:7::: mail:*:17834:0:99999:7::: operator:*:17834:0:99999:7::: games:*:17834:0:99999:7::: ftp:*:17834:0:99999:7::: nobody:*:17834:0:99999:7::: systemd-network:!!:18085:::::: dbus:!!:18085:::::: polkitd:!!:18085:::::: libstoragemgmt:!!:18085:::::: abrt:!!:18085:::::: rpc:!!:18085:0:99999:7::: apache:!!:18085:::::: sshd:!!:18085:::::: postfix:!!:18085:::::: ntp:!!:18085:::::: chrony:!!:18085:::::: tcpdump:!!:18085:::::: quail:$6$Kc3NU.IzbnLHJB/w$UQPSQJng5IAt4a0zn.be9QP/WWay3p8ou.hA.o/hr8mIqYT0UX7Gn1MTyzOsfioBL4ere3l4bYbEyI.HUspHb.::0:99999:7:::
字段解析: (用户名):(加密密码):(密码最后更新时间):(修改间隔):(密码时效性不):(快到期警告时间):(到期宽限时 间):(账号失效时间):(保留)
/etc/group 保存组信息
[root@localhost ~]# cat /etc/group root:x:0: bin:x:1: daemon:x:2: sys:x:3: adm:x:4: tty:x:5: disk:x:6: lp:x:7: mem:x:8: kmem:x:9: wheel:x:10: cdrom:x:11: mail:x:12:postfix man:x:15: dialout:x:18: floppy:x:19: games:x:20: tape:x:33: video:x:39: ftp:x:50: lock:x:54: audio:x:63: nobody:x:99: users:x:100: utmp:x:22: utempter:x:35: input:x:999: systemd-journal:x:190: systemd-network:x:192: dbus:x:81: polkitd:x:998: libstoragemgmt:x:997: ssh_keys:x:996: abrt:x:173: rpc:x:32: apache:x:48: sshd:x:74: slocate:x:21: postdrop:x:90: postfix:x:89: ntp:x:38: chrony:x:995: tcpdump:x:72: stapusr:x:156: stapsys:x:157: stapdev:x:158: quail:x:1000:quail
字段解析: 用户组名:密码:GID号:组中附加的用户
/etc/login.defs 用户属性限制,密码过期时间,密码最大长度等限制
[root@localhost ~]# cat /etc/login.defs # # Please note that the parameters in this configuration file control the # behavior of the tools from the shadow-utils component. None of these # tools uses the PAM mechanism, and the utilities that use PAM (such as the # passwd command) should therefore be configured elsewhere. Refer to # /etc/pam.d/system-auth for more information. # # *REQUIRED* # Directory where mailboxes reside, _or_ name of file, relative to the # home directory. If you _do_ define both, MAIL_DIR takes precedence. # QMAIL_DIR is for Qmail # #QMAIL_DIR Maildir MAIL_DIR /var/spool/mail #MAIL_FILE .mail # Password aging controls: # # PASS_MAX_DAYS Maximum number of days a password may be used. # PASS_MIN_DAYS Minimum number of days allowed between password changes. # PASS_MIN_LEN Minimum acceptable password length. # PASS_WARN_AGE Number of days warning given before a password expires. # PASS_MAX_DAYS 99999 PASS_MIN_DAYS 0 PASS_MIN_LEN 5 PASS_WARN_AGE 7 # # Min/max values for automatic uid selection in useradd # UID_MIN 1000 UID_MAX 60000 # System accounts SYS_UID_MIN 201 SYS_UID_MAX 999 # # Min/max values for automatic gid selection in groupadd # GID_MIN 1000 GID_MAX 60000 # System accounts SYS_GID_MIN 201 SYS_GID_MAX 999 # # If defined, this command is run when removing a user. # It should remove any at/cron/print jobs etc. owned by # the user to be removed (passed as the first argument). # #USERDEL_CMD /usr/sbin/userdel_local # # If useradd should create home directories for users by default # On RH systems, we do. This option is overridden with the -m flag on # useradd command line. # CREATE_HOME yes # The permission mask is initialized to this value. If not specified, # the permission mask will be initialized to 022. UMASK 077 # This enables userdel to remove user groups if no members exist. # USERGROUPS_ENAB yes # Use SHA512 to encrypt password. ENCRYPT_METHOD SHA512
/etc/default/useradd 显示或更改默认的useradd配置文件
[root@localhost ~]# cat /etc/default/useradd # useradd defaults file GROUP=100 HOME=/home INACTIVE=-1 EXPIRE= SHELL=/bin/bash SKEL=/etc/skel CREATE_MAIL_SPOOL=yes
Linux权限是操作系统用来限制对资源访问的机制,权限一般分为读、写、执行。系统中每个文件都拥有特定的权 限、所属用户及所属组,通过这样的机制来限制哪些用户或用户组可以对特定文件进行相应的操作。
Linux中有的文件及文件夹都有至少权限三种权限 权限 对文件的影响 对目录的影响 :
r(读取) 可读取文件内容 可列出目录内容
w(写入) 可修改文件内容 可在目录中创建删除内容
x(执行) 可作为命令执行 可访问目录内容
目录必须拥有x权限,否则无法查看其内容
-:普通文件
d :目录文件
l:链接文件
b:块设备文件
c:字符设备文件
p:管道文件
[root@localhost home]# ll test.txt -rwxrw-r--. 1 root root 107 Jul 10 22:16 test.txt #上面目录权限分解: #U:rwx----->user------>root 用户对于test.txt拥有的权限(属主) #G:rw------>group------>root 组对于text.txt拥有的权限 (属组) #O:r--------other-------> * 其他用户对于test.txt拥有的权限 (其他人)
对于test.txt文件属性参数详解如下:
[root@localhost home]# ll test drwxrw-r--. 2 root root 107 Jul 10 22:16 test · d 表示目录,同一位置如果为-则表示普通文件; · rwxrw-r--表示三种角色的权限,每三位为一种角色,依次为U,G,O权限,如上则表示user的权限为rwx, group的权限为rw-,other的权限为r--; · 2表示文件夹的链接数量,可理解为该目录下子目录的数量(目录的链接数量至少为2.因为内含:.和..两个特殊目录) · 从左到右,第一个root表示该用户名(文件所属主,对应前面三位一体权限的“user”),第二个root则为组名 (文件所属组,对应前面三位一体权限的“group”),其他人角色默认不显示(其他人权限,对应前面三位一体权限 的“other”); · 107表示该文件夹占据的字节数; · Jul 10 22:16 表示文件创建或者修改的时间; · test 为目录的名,或者文件名。
标签:三种权限 systemd 授权 conf before defs 使用 失效 systems
原文地址:https://www.cnblogs.com/quail2333/p/11172121.html