passwd 中文man页面

系统
Passwd 是个文本文件, 它包含了一个系统帐户列表, 给出每个帐户一些有用的信息,比如用户 ID,组 ID, 家目录, shell,等. 通常它也包含了每个用户经过加密的密码. 它通常应该是可读的(许多命令,工具程序,象 ls(1) 用它做用户 Id 到用户名称的映射),但是只允许超级用户有写方式权限.

NAME 名称

passwd - 密码文件  

描述

Passwd 是个文本文件, 它包含了一个系统帐户列表, 给出每个帐户一些有用的信息,比如用户 ID,组 ID, 家目录, shell,等. 通常它也包含了每个用户经过加密的密码. 它通常应该是可读的(许多命令,工具程序,象 ls(1) 用它做用户 Id 到用户名称的映射),但是只允许超级用户有写方式权限.

在过去美好的日子里,这种一般的读许可没有什么大问题. 每个人都能读到加密了的密码,因为硬件太慢以至于不能解开一个精选的密码,另外,这基本假定是为友好的使用团体使用的. 现在,许多人运行一些版本的影子密码套件,它们在 /etc/passwd 的密码域里是 *,而不再是加密的口令,加密的口令放在 /etc/shadow 中,那个文件只有超级用户能读.

不管是否使用了影子密码,许多系统管理员使用一个星号在加密的密码字段以确保用户不能鉴别他(她)自己的密码. (见下面的注意)

如果你建立了一个新的登录,首先放个星号在密码字段, 然后使用 passwd(1) 设置它.

(密码文件)里每行一条记录,并且每行有这样的格式:

account:password:UID:GID:GECOS:directory:shell (帐号:密码:用户ID:组ID:一般的信息:目录:shell)

字段描述如下:

account
使用者在系统中的名字,它不能包含大写字母.
password
加密的用户密码,或者星号。
UID
用户 ID 数。
GID
用户的主要组 ID 数。
GECOS
这字段是可选的,通常为了存放信息目的而设的.通常,它包含了用户的全名. GECOS 意思是通用电气综合操作系统(General Electric Comprehensive Operating System), 当 GE 的大型系统部分割售卖给 Honeywell 时它被改为 GCOS. Dennis Ritchie 作过报告:"有时我们发送印刷品或批道作业到 GCOS机器时,gcos 字段打断了 $IDENT 卡的信息,不太美观。"(译者:我想是太长吧)
directory
用户的 $HOME 目录.
shell
登录时运行的程序(如果空的,使用 /bin/sh). 如果设为不存在的执行(程序),用户不能通过 login(1) 登录.

注意

如果你想建立用户组,他们的 GID 必须相等并且一定是在 /etc/group的一条记录, 要不然组就不存在.

如果加密密码设成星号,用户将不能用 login(1) 来登录, 但依然可以用 rlogin(1) 登录, 通过 rsh(1) 或者 cron(1) 或者 at(1) 或者 mail 过滤器等程序运行已有的进程和开始新的等. 试图通过简单改变 shell 字段锁住一个用户结果是一样的,而且还附上了使用 su(1) 的权限.  

相关文件

/etc/passwd  

又见

passwd(1), login(1), su(1), group(5), shadow(5)
#p#

NAME

passwd - password file  

DESCRIPTION

Passwd is a text file, that contains a list of the system's accounts, giving for each account some useful information like user ID, group ID, home directory, shell, etc. Often, it also contains the encrypted passwords for each account. It should have general read permission (many utilities, like ls(1) use it to map user IDs to user names), but write access only for the superuser.

In the good old days there was no great problem with this general read permission. Everybody could read the encrypted passwords, but the hardware was too slow to crack a well-chosen password, and moreover, the basic assumption used to be that of a friendly user-community. These days many people run some version of the shadow password suite, where /etc/passwd has *'s instead of encrypted passwords, and the encrypted passwords are in /etc/shadow which is readable by the superuser only.

Regardless of whether shadow passwords are used, many sysadmins use a star in the encrypted password field to make sure that this user can not authenticate him- or herself using a password. (But see the Notes below.)

If you create a new login, first put a star in the password field, then use passwd(1) to set it.

There is one entry per line, and each line has the format:

account:password:UID:GID:GECOS:directory:shell

The field descriptions are:

account
the name of the user on the system. It should not contain capital letters.
password
the encrypted user password or a star.
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 full user name. GECOS means General Electric Comprehensive Operating System, which has been renamed to 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 the password 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, the user will be unable to login through login(1).

NOTE

If you want to create user groups, their GIDs must be equal and there must be an entry in /etc/group, or no group will exist.

If the encrypted password is set to a star, the user will be unable to login using login(1), but may still login using rlogin(1), run existing processes and initiate new ones through rsh(1), cron(1), at(1), or mail filters, etc. Trying to lock an account by simply changing the shell field yields the same result and additionally allows the use of su(1).  

FILES

/etc/passwd  

SEE ALSO

passwd(1), login(1), su(1), group(5), shadow(5)

责任编辑:韩亚珊 来源: CMPP.net
相关推荐

2011-08-16 10:54:03

passwd中文man

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-11-01 13:46:50

中文mantac

2011-08-25 16:55:26

gets中文man

2011-08-25 15:49:02

freopen中文man

2011-08-25 16:00:56

fflush中文man

2011-08-25 16:08:55

fsetpos中文man

2011-08-25 15:33:18

exit中文man

2011-08-24 17:19:00

raw中文man

2011-08-25 10:55:37

services中文man

2011-08-25 09:35:26

units中文man

2011-08-24 16:16:07

LISTEN中文man

2011-08-24 13:57:35

DECLARE中文man

2011-08-11 15:28:43

ali中文man

2011-08-16 10:10:58

setup中文man

2011-08-23 17:18:44

umount中文man

2011-08-23 17:24:11

userdel中文man
点赞
收藏

51CTO技术栈公众号