linux笔记_day06
1.用户:表示符,凭证
2.用户组:表示符
进程也是有属主和属组的
安全上下文(secure context):
用户:UID,/etc/pawwd
组:GID ,/etc/group
影子口令:
用户:/etc/shadow
组:/etc/gshadow
用户类别:
管理员:uid=0
普通用户:1-65535
系统用户1-499(后台进程的属主)
一般用户500-60000
用户组类别:
基本组:用户的默认组
私有组: 在创建用户时,如果没有给用户指定其所属的组,系统会默认给用户创建一个和用户同名的组。
附加组:
进程被发起之前是个可执行文件,文件执行之前的权限,进程的权限是进程发起者的身份(进程可以使用那些资源文件,由发起者决定,不是文件的所属者)
[root@good eric usr]# whatis passwd passwd (1) - update user's authentication tokens passwd (5) - password file passwd [sslpasswd] (1ssl) - compute password hashes [root@good eric usr]# man 5 passwdThe field descriptions are:account the name of the user on the system. It should not contain capital letters.password the encrypted user password, an asterisk (*), or the letter 'x'. (See pwconv(8) for an expla-nation of 'x'.)UID the numerical user ID.GID the numerical primary group ID for this user.GECOS This field is optional and only used for informational purposes. Usually, it contains the fullusername. GECOS means General Electric Comprehensive Operating System, which has been renamedto GCOS when GE’s large systems division was sold to Honeywell. Dennis Ritchie has reported:"Sometimes we sent printer output or batch jobs to the GCOS machine. The gcos field in thepassword file was a place to stash the information for the $IDENTcard. Not elegant."directory the user’s $HOME directory.shell the program to run at login (if empty, use /bin/sh). If set to a non-existing executable, theuser will be unable to login through login(1).用户默认shell
添加用户
[root@good eric usr]# which useradd /usr/sbin/useradd [root@good eric usr]# ls -l `which useradd` -rwxr-x---. 1 root root 111320 Feb 9 2016 /usr/sbin/useradd [root@good eric usr]# useradd tom [root@good eric usr]# tail -1 /etc/passwd tom:x:501:501::/home/tom:/bin/bash [root@good eric usr]# tail -1 /etc/shadow tom:!!:17299:0:99999:7::: [root@good eric usr]# passwd tom New password: BAD PASSWORD: it is based on a dictionary word BAD PASSWORD: is too simple Retype new password: passwd: all authentication tokens updated successfully. [root@good eric usr]# tail -1 /etc/shadow tom:$1$0G6ELf7b$W46ShX5zObXOfepp6Eb8p/:17299:0:99999:7::: [root@good eric usr]# [root@good eric default]# cd /etc/default/ [root@good eric default]# ls nss useradd [root@good eric default]# file useradd useradd: ASCII text [root@good eric default]#
useradd -c The ‘-c‘ option allows you to add custom comments, such as user’s full name, phone number, etc to /etc/passwd file