Page 161 - DCAP602_NETWORK_OPERATING_SYSTEMS_I
P. 161
Unit 9: File System Commands
Files those hold accounting information are as follows: notes
1. /var/log/wtmp – Stores information about all logins and logouts.
2. /var/run/utmp – Stores information about who is currently on the system and is used by the
who command.
3. /var/log/btmp – Used to store information about failed logins.
9.1.1 the /etc/passwd file
/etc/passwd is a text file that contains the attributes of (i.e., basic information about) each user or
account on a computer running Linux or another Unix-like operating system.
The permissions for /etc/passwd are by default set so that it is world readable, that is, so that it
can be read by any user on the system. The file can be easily read using a text editor (such as gedit
or vi) or with a command such as cat, which is commonly used to read files, i.e.,
cat /etc/passwd
Each line in /etc/passwd represents a single user. The first listed is the root (i.e., administrative)
account, which has complete power over every aspect of the system. This is followed by system-
defined groups and accounts that are required for proper installation and update of system
software. The lines at the end represent real people who use the system.
Each line contains seven attributes or fields: name, password, user ID, group ID, gecos, home
directory and shell. Each attribute is separated from the adjacent attributes by colons but with
no spaces. Colons must not be used in the attributes themselves, in order to avoid confusing the
system. If there is no data for an attribute, there is no space, but, rather, two consecutive colons.
Name is the user’s login name, that is the name that a user types in when logging into the system.
Each such name must be unique string (i.e., sequence of characters).
The password field originally contained an encrypted login password. However, for security
reasons, the encrypted passwords are now contained on another file, /etc/shadow, that cannot
be read by ordinary users. This field now merely contains the letter x to indicate that a password
has been assigned to the user and is required for authentication. If this field is empty, the user
can log in without a password.
User ID is the user’s unique numeric identification number, which is used by the system for
access control. Zero is reserved for the root account, and one through 99 are reserved for other
predefined accounts. 100 through 999 are available for ordinary users and groups.
Group ID specifies the user’s principal group identification number. This is usually the same as
the user ID.
Named for historical reasons, gecos contains general information about the user that is not
needed by the system, most commonly the user’s real name. This field can be empty, in which
case there is no space between the two delimiting colons. Alternatively, it can contain multiple
entries, each separated by a comma.
Home directory is the full path (i.e., the location relative to the root directory) of the user’s home
directory. This is the directory that the user is first in when logging into the system and which
contains programs and configuration files specific to that user.
Shell is the full path of the default shell for the user. A shell is a program that provides a text-only
user interface and whose main purpose is to execute commands typed in by a user and display
the results. The default shell on Linux is bash, whose absolute path is /bin/bash.
LoveLy professionaL university 155