Linux系统中,用户的关键信息被存放在系统的/etc/passwd文件中,系统的每一个合法用户账号对应于该文件中的一行记录,可以通过命令sudo cat /etc/passwd来查看此类信息。每行记录定义了每个用户账号的属性。下面是一个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
… …

  从中可以看到每一行用户记录的各个数据块用“:”分隔,共有七段,分别定义了用户的各方面属性,各个字段的顺序和含义如下:

  注册名:口令:用户标识号:组标识号:用户信息:用户主目录:命令解释程序

(1)注册名(login_name):用于区分不同的用户且唯一存在,字母大小写是敏感

(2)口令(passwd):系统用口令来验证用户的合法性。超级用户root或某些高级用户可以使用系统命令passwd来更改系统中所有用户的口令,普通用户也可以在登录系统后使用passwd命令来更改自己的口令,此数据块一般显示为X.此外,需要注意的是,如果passwd字段中的第一个字符是 “*”的话,那么,就表示该账号被查封了,系统不允许持有该账号的用户登录。

(3)用户标识号(UID):UID是一个数值,是Linux系统中惟一的用户标识,用于区别不同的用户。在Linux系统中,注册名和UID都可以用于标识用户,只不过对于系统来说UID更为重要;而对于用户来说注册名使用起来更方便。在某些特定目的下,系统中可以存在多个拥有不同注册名、但UID相同的用户,事实上,这些使用不同注册名的用户实际上是同一个用户。

(4)组标识号(GID):工作组标识。具有相似属性的多个用户可以被分配到同一个组内,每个组都有自己的组名,且以自己的组标识号相区分。像UID一样,用户的组标识号也存放在passwd文件中。用户可以同时属于多个组。除了在 passwd文件中指定其归属的基本组之外,还在/etc/group文件中指明一个组所包含用户。

(5)用户信息(user_name):包含有关用户的一些信息,如用户的真实姓名、办公室地址、联系电话等

(6)用户主目录(home_directory):该字段定义了个人用户的主目录,当用户登录后,他的Shell将把该目录作为用户的工作目录。

(7)命令解释程序(Shell):Shell是当用户登录系统时运行的程序名称,通常是一个Shell程序的全路径名,如/bin/bash。

通常在Linux系统中,用户的关键信息被存放在系统的/etc/passwd文件中,系统的每一个合法用户账号对应于该文件中的一行记录。这行记录定义了每个用户账号的属性

29 Comments

  1. Definitely believe that which you said. Your favorite reason seemed to be on the web the easiest thing to be aware of. I say to you, I certainly get irked while people think about worries that they plainly don’t know about. You managed to hit the nail upon the top and defined out the whole thing without having side effect , people can take a signal. Will probably be back to get more. Thanks

  2. Definitely believe that which you said. Your favorite reason appeared to be on the internet the easiest thing to be aware of. I say to you, I certainly get annoyed while people think about worries that they just don’t know about. You managed to hit the nail upon the top as well as defined out the whole thing without having side effect , people could take a signal. Will probably be back to get more. Thanks

  3. After examine a few of the blog posts on your web site now, and I really like your approach of blogging. I bookmarked it to my bookmark web site listing and will be checking back soon. Pls take a look at my website as nicely and let me know what you think.

  4. I like the helpful information you provide in your articles. I’ll bookmark your weblog and check again here regularly. I’m quite certain I will learn plenty of new stuff right here! Best of luck for the next!

  5. Just thought I’d drop you a line to tell you your site really rocks! I have been looking for this sort of information for a long time.. Such a type of blog post will definitely click to numerous viewers. A good article and useful for its written content. Many thanks for sharing it up! An increase in Amazing Additional.

  6. After examine a number of of the weblog posts on your website now, and I actually like your method of blogging. I bookmarked it to my bookmark website list and can be checking back soon. Pls take a look at my website as nicely and let me know what you think.

发表评论

电子邮件地址不会被公开。 必填项已用*标注

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


*