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. I’d be inclined to concur with you one this subject. Which is not something I typically do! I love reading a post that will make people think. Also, thanks for allowing me to speak my mind!

  2. I’d be inclined to buy into with you here. Which is not something I usually do! I enjoy reading a post that will make people think. Also, thanks for allowing me to speak my mind!

  3. “Aw, this was a truly quality put up. In principle I’d like to write such as this too – taking time and actual work to produce a excellent write-up..!.!. but what can I say.!!!. I procrastinate alot and in no way appear to get some thing done. ”

    ——————————————–
    my website is
    http://toclimb.org

    Also welcome you!

  4. “The purpose within your internet site might be good for my students. A lot of fantastic options are free in here. Initially, I have launched your site to my college students in my class, so do not be perplexed if your website hits are improve considerably. I discuss many subjects, still debating in each and every facet that may be debated, and at the finish of my type (each week), I advised them concerning the conclusion of your theme. Hot subject and ambiance might be enjoyable right here. And then, you may possibly be surprised that my college students obtained new story every single day, as well as all of them can express their idea in house and school. Specially they advised to her/his mom/dad, that they learnt a lot of subjects from instructor that learnt from you. Surprisingly that everybody desires to get new problem inside your strategy, after which when I give new subject, it is often challenging for all of my students.”

    ——————————————–
    my website is tech deck skateboards .Also welcome you!

发表回复

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

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>


*