14

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,,, ?

marked as duplicate by chaos, Anthon, jasonwryan, John WH Smith, cuonglm Feb 27 '15 at 10:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    That is the GECOS field described in this answer a year ago. – Anthon Feb 26 '15 at 16:01
18

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.

  • 4
    Actually never in at least 10 years have I seen or administrated a system where any of this metadata were set or used anywhere. Just like with all login names all over the internet, people are quite happy to identify by the username alone and apparently don't care enough to set anything (if I want to call someone on the phone, linux user profile is the last place I will look). For most applications that deal with user profiles, this isn't enough anyway, and have to maintain their own database. Are there any frequently used applications that would make use of these fields? – orion Feb 26 '15 at 10:50
  • Agreed. As to the question: never heard of any, not to mention using one. – Erathiel Feb 26 '15 at 10:55
  • while I +1 @orion sometime this field can be use, for instance in a system were people from different company work. I'll wholy agree, however, this is the last place to search for phone number. – Archemar Feb 26 '15 at 12:28
  • 1
    @Sebb. No it's not, it's the ':' that are important. Commands that do need to parse this field (or fields), work just as happily if the field just contain your real name (with spaces and so on). – Baard Kopperud Feb 26 '15 at 15:13
  • 1
    @orion I remember the good old days when everyone would simply finger each other to find out more information about what they were working on from their .plan – Damian Nikodem Feb 27 '15 at 0:39
13

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.

3

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

0

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 .

-1

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

  • more me pasword – djthosi Feb 26 '15 at 16:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.