passwd — password file
The /etc/passwd
file is a
text file that describes user login accounts for the system.
It should have read permission allowed for all users (many
utilities, like ls(1) use it to map user
IDs to usernames), 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 asterisks (*)
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 system administrators use an asterisk in the encrypted password field to make sure that this user can not authenticate him- or herself using a password. (But see NOTES below.)
If you create a new login, first put an asterisk in the password field, then use passwd(1) to set it.
Each line of the file describes a single user, and has the following format:
account:password:UID:GID:GECOS:directory:shell
The field are as follows:
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 explanation of 'x'.)
UID
the numeric user ID.
GID
the numeric primary group ID for this user.
GECOS
This field is optional and used only for informational purposes. Usually, it contains the full username. GECOS stands for "General Electric Comprehensive Operating System", which was 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
nonexistent executable, the user will be unable to
login through login(1).
If you want to create user groups, there must be an entry
in /etc/group
, or no group will
exist.
If the encrypted password is set to an asterisk, 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(8), 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).
This page is part of release 3.33 of the Linux man-pages
project. A
description of the project, and information about reporting
bugs, can be found at http://man7.org/linux/man-pages/.
Copyright (c) 1993 Michael Haardt (michaelmoria.de), Fri Apr 2 11:32:09 MET DST 1993 This is free documentation; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU General Public License's references to "object code" and "executables" are to be interpreted as the output of any document formatting or typesetting system, including intermediate and printed output. This manual is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this manual; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. Modified Sun Jul 25 10:46:28 1993 by Rik Faith (faithcs.unc.edu) Modified Sun Aug 21 18:12:27 1994 by Rik Faith (faithcs.unc.edu) Modified Sun Jun 18 01:53:57 1995 by Andries Brouwer (aebcwi.nl) Modified Mon Jan 5 20:24:40 MET 1998 by Michael Haardt (michaelcantor.informatik.rwth-aachen.de) |