What does ",,," mean in the 5 column in /etc/passwd file?

There are 7 fields in the /etc/passwd file :username,Password,User ID (UID),Group ID (GID),User ID Info,Home directory,Command/shell.

Part of rows in my /etc/passwd :

avahi:x:105:110:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false
usbmux:x:106:46:usbmux daemon,,,:/home/usbmux:/bin/false
postgres:x:110:120:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash

The 5th column are the same format ,many , in it,what do the , mean here?Take a example PostgreSQL administrator,,, What does ,,, mean in PostgreSQL administrator,,, ?

Asked By: showkey

||

The 5th field is sometimes known as the “GECOS” field (it stands for “General Electric Comprehensive Operating System”), and it is typically used to record additional information about the user – real name, building or room number, phone number, and any additional contact information (fax, pager number, etc). These subfields are comma delimited. In your passwd file, the commas simply denote the otherwise unused fields.

Most systems that I have ever used, including FreeBSD, Solaris, and several Linuxes, simply put in a real user name, and don’t include any of the other information, and don’t include the empty subfields.

Answered By: D_Bye

You’ve partly answered your own question, probably not realising you did 🙂 The clue is hidden within the field list and the excerpt from /etc/passwd you’ve provided. See how the fields in the passwd file are separated by a :? The commas there are a part of the User ID Info field and include the following data: Full Name, Room Number, Work Phone, Home Phone, Other.

If you take a look at the process of adding a user you will see that clearly. Here, see this (taken from a Debian-based system):

root # adduser test
Adding user `test' ...
Adding new group `test' (1003) ...
Adding new user `test' (1002) with group `test' ...
Creating home directory `/home/test' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for test
Enter the new value, or press ENTER for the default
    Full Name []: Test Name
    Room Number []: 302
    Work Phone []: 1234567890
    Home Phone []: 1234567891
    Other []: This is just a comment
Is the information correct? [Y/n] y
root # grep test /etc/passwd
test:x:1002:1003:Test Name,302,1234567890,1234567891,This is just a comment:/home/test:/bin/bash

Above you can see where the information was provided by me and where it is stored in /etc/passwd. No stray commas are in evidence.

I can’t remember ever seeing a system that had these fields filled-up, however. This additional info is probably left blank by most admins most of the time, except for the Full Name perhaps.

Answered By: Erathiel

This is just a comment, so you should not worry about it.

From info passwd:

Each line of the file describes a single user, and contains seven
colon-separated fields:

          name:password:UID:GID:**GECOS**:directory:shell

The field are as follows:

GECOS

This field (sometimes called the “comment field”) is optional and used only for informational purposes. Usually, it contains the full
username
. Some programs (for example, finger(1)) display information
from this field.

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.”

Answered By: fedorqui

Each line of the file describes a single user, and contains seven colon-separated fields:

      name:password:UID:GID:**GECOS**:directory:shell

The field are as follows:

GECOS

This field (sometimes called the “comment field”) is optional and used only for informational purposes. Usually, it contains the full username. Some programs (for example, finger(1)) display information from this field.

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.”

Answered By: djthosi

in addition to layout and definition , provided in other answers , let us talk about the usage , ways to edit and retrieve information of these fields .

first as described by Erathiel , debian systems have the adduser command , that will ask five questions and set the corresponding fields upon user creation . i remember suse have no adduser , and gentoo have adduser alias for useradd , and useradd do not ask such questions .

a user can volunteer to update the information in record , with chfn(1) .

kate@abc.com$ chfn --full-name "catherine fantasy"
                   --work-phone "1234"
                   --other "beautiful haircut"

these is a pair of finger/fingerd client and service .

ivan@abc.com$ finger kate
        -- or --
dave@xyz.org$ finger kate@a.com
full name : catherine fantasy
work phone ...
...

provided fingerd is running on abc.com machine and configured to allow such queries .

Answered By: 把友情留在无盐
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.