Alguém pode explicar a saída do comando getent passwd?

3

mymac é minha conta de usuário pessoal na máquina de juggernaut

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

O que isso significa x, 1000, 1000? E as vírgulas que se seguem?

Por analogia, explique também:

root:x:0:0:root:/root:/bin/bash
    
por juggernaut1996 24.01.2016 / 20:02

1 resposta

7

Em 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

O x seria a senha criptografada opcional, sobre a qual a manpage continua:

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

As vírgulas estão separando os campos GECOS :

  

O formato típico para o campo GECOS é uma lista delimitada por vírgulas com   esta ordem:

     
  1. Nome completo do usuário (ou nome do aplicativo, se a conta for de um programa)
  2.   
  3. Número do prédio e da sala ou pessoa de contato
  4.   
  5. Número de telefone do escritório
  6.   
  7. Qualquer outra informação de contato (número de pager, fax, etc.)
  8.   

Então:

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
    
por muru 24.01.2016 / 20:05