Chinaunix首页 | 论坛 | 博客
  • 博客访问: 316471
  • 博文数量: 84
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 890
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-13 16:46
文章分类

全部博文(84)

文章存档

2017年(2)

2016年(4)

2015年(78)

我的朋友

分类: LINUX

2015-06-24 11:24:39

每一行都代表一个账号,有几行就代表有几个账号在你的系统中;不过需要特别留意的是,里面很多账号本来就是系统正常运行所必须的,我们可以简称它为系统账号,例如bin,daemon,adm等等。这些账号不要随意删除。
  1. [root@RHEL6 ~]# head -n 4 /etc/passwd
  2. root:x:0:0:root:/root:/bin/bash
  3. bin:x:1:1:bin:/bin:/sbin/nologin
  4. daemon:x:2:2:daemon:/sbin:/sbin/nologin
  5. adm:x:3:4:adm:/var/adm:/sbin/nologin
每一行都使用":"作为分隔符,共有7个字段,分别是
1、账号名称
2、密码,早期密码是放在这里的,但后期为了安全,将整个字段的密码数据改放到/etc/shadow中了,所以这里看到一个“x”
3、UID
4、GID
5、用户信息说明,没什么重要用途,只是用来解释整个账号的意义而已
6、主文件夹,家目录$HOME
7、shell,此字段可以定义用户默认使用的shell,默认是/bin/bash;有一个shell可以用来替代成让账号无法取得shell环境的登陆操作,那就是/sbin/nologin。

man 5 passwd命令关于passwd文件的字段的描述如下 
  1. The field descriptions are:
  2.        account the name of the user on the system. It should not contain capital letters.
  3.        password the encrypted user password, an asterisk (*), or the letter 'x'. (See pwconv(8)
  4.                  for an explanation of 'x'.)
  5.        UID the numerical user ID.
  6.        GID the numerical primary group ID for this user.
  7.        GECOS This field is optional and only used for informational purposes. Usually, it con-
  8.                  tains the full username. GECOS means General Electric Comprehensive Operating
  9.                  System, which has been renamed to GCOS when GE's large systems division was sold
  10.                  to Honeywell. Dennis Ritchie has reported: "Sometimes we sent printer output or
  11.                  batch jobs to the GCOS machine. The gcos field in the password file was a place
  12.                  to stash the information for the $IDENTcard. Not elegant."
  13.        directory the user's $HOME directory.
  14.        shell the program to run at login (if empty, use /bin/sh). If set to a non-existing
  15.                 executable, the user will be unable to login through login(1).

阅读(1173) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~