The first and probably most important user-related configuration file is /etc/passwd. This file is the primary database where user information is stored: everything except the user password is stored in this file. In Listing 5-1, you can get an impression of what the fields in this file look like.
Listing 5-1. Contents of the User Database/etc/passwd dhcpd:x:102:65534:DHCP server daemon:/var/lib/dhcp:/bin/false radiusd:x:103:103:Radius daemon:/var/lib/radiusd:/bin/false privoxy:x:104:104:Daemon user for privoxy:/var/lib/privoxy:/bin/false vdr:x:105:33:Video Disk Recorder:/var/spool/video:/bin/false quagga:x:106:106:Quagga routing daemon:/var/run/quagga:/bin/false nobody:x:65534:65533:nobody:/var/lib/nobody:/bin/bash sander:x:1000:100:sander:/home/sander:/bin/bash linda:x:1001:100:Linda Thomassen:/home/linda:/bin/bash kluser:x:1002:1000::/var/db/kav:/sbin/nologin jgoldman:x:1003:100::/home/jgoldman:/bin/bash
In /etc/passwd, you'll see the following fields, separated with a colon:
Loginname: In the first field in /etc/passwd, the user's login name is stored. In older Unix versions, there was a maximum length limitation on login names; they could be eight characters maximum. In SUSE Linux Enterprise Server, this limitation doesn't exist.
Password: In older Unix versions, the encrypted passwords were stored in this file. However, one major issue existed when passwords were stored here, even if encryption was used: everyone was allowed to read /etc/passwd. Therefore, an intruder would be able to read the encrypted passwords as well. Since this poses a security risk, nowadays passwords are stored in the configuration file /etc/shadow, which is discussed in the next section. When passwords are stored in the shadow file, this field will contain only the character x.
UID: As you have already learned, every user has a unique UID. SUSE Linux Enterprise Server starts numbering local UIDs at 1,000, and typically the highest number that should be used is 65,550 (the highest numbers are reserved for special-purpose accounts).
Note SUSE starts numbering user accounts automatically at UID 1,000. Want to change that? Check the file /etc/login.defs where you can set a parameter to tune this.
GID: As discussed in the previous section, every user has a primary group. The group ID (GID) of this primary group is listed here. For ordinary users, by default the GID 100, which belongs to the group users, is used.
GECOS: The General Electric Comprehensive Operating System (GECOS) field includes some comments about the user. This makes identifying a user easier for an administrator. The GECOS field, however, is optional, and often you will see that it is not used at all.
Home directory: This is a reference to the directory used for the user's home directory. Note that it is only a reference and has nothing to do with the real directory; so the fact that you see something here doesn't mean the directory that is listed here also really exists.
Shell: The latest field in /etc/passwd refers to the program that should be started automatically when a user logs in. Most often, this will be /bin/bash, but as discussed in the preceding section, every binary program can be referred to here, as long as the complete path name is used.
For an administrator, it is perfectly possible to edit /etc/passwd and the related file /etc/shadow manually. If you make an error, however, the consequences can be serious; it can even lead to a system where logging in is no longer possible. Therefore, if you make manual changes to any of these files, you should check the integrity of these files. To do this, use the pwck command. You can run this command without any options, and it will tell whether any serious problems need fixing.
Was this article helpful?