7

mymac is my personal user account on juggernaut machine

mymac:x:1000:1000:juggernaut,,,:/home/mymac:/bin/bash

What does that x, 1000 , 1000 mean? And the commas that follow?

In analogy, also explain:

root:x:0:0:root:/root:/bin/bash
14

From man 5 passwd:

/etc/passwd contains one line for each user account, with seven fields
delimited by colons (“:”). These fields are:

·   login name
·   optional encrypted password
·   numerical user ID
·   numerical group ID
·   user name or comment field
·   user home directory
·   optional user command interpreter

The x would be the optional encrypted password, about which the manpage further goes on to say:

The encrypted password field may be blank, in which case no password is
required to authenticate as the specified login name. However, some
applications which read the /etc/passwd file may decide not to permit
any access at all if the password field is blank. If the password field
is a lower-case “x”, then the encrypted password is actually stored in
the shadow(5) file instead; there must be a corresponding line in the
/etc/shadow file, or else the user account is invalid. If the password
field is any other string, then it will be treated as an encrypted
password, as specified by crypt(3).

The commas are separating the GECOS fields:

The typical format for the GECOS field is a comma-delimited list with this order:

  1. User's full name (or application name, if the account is for a program)
  2. Building and room number or contact person
  3. Office telephone number
  4. Any other contact information (pager number, fax, etc.)

So:

mymac:x:1000:1000:juggernaut,,,:/home/mymac:/bin/bash
|     |  |    |    |             |             |
|     |  |    |    |             |             Login shell
|     |  |    |    |             Home directory
|     |  |    |    GECOS fields (full name, etc.)
|     |  |    Primary Group id
|     |  User ID
|     Encrypted password indicator
Username
| improve this answer | |
  • one more thing... can u also explain the entries in shadow file? – juggernauthk108 Jan 24 '16 at 19:29
  • @juggernaut1996 See man 5 shadow. – muru Jan 24 '16 at 19:30
  • 2
    @juggernaut1996 So, should I copy paste another manpage for you? The explanations in man 5 shadow are pretty clear. – muru Jan 24 '16 at 19:32
  • Why "man 5 passwd" and not "man passwd"? I did "man man" but I didn't get it. – Noumenon May 2 '17 at 21:23
  • 2
    @Noumenon askubuntu.com/q/647051/158442 – muru May 3 '17 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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