Como gerar uma senha compatível com / etc / shadow para o Ubuntu 10.04?

10

Como as senhas geradas são usadas pelo Ubuntu 10.04? Eu sei que eles usam SHA 512 como algoritmo de hashing, mas eu acho que há algum tipo de salga feita. Eu preciso gerar essa senha eu mesmo. Como eu posso fazer isso? Existe uma ferramenta de linha de comando para isso?

    
por t6d 14.04.2011 / 17:58

1 resposta

14

Deve ser trivial hackear um script rápido python / perl / whatever e chamar o crypt (3) função.

The glibc2 version of this function supports additional encryption algorithms.

If salt is a character string starting with the characters "$id$" followed by
a string terminated by "$":

      $id$salt$encrypted

then instead of using the DES machine, id identifies the encryption method
used and this then determines how the rest of the password string is
interpreted.  The following values of id are supported:

      ID  | Method
      ---------------------------------------------------------
      1   | MD5
      2a  | Blowfish (not in mainline glibc; added in some
          | Linux distributions)
      5   | SHA-256 (since glibc 2.7)
      6   | SHA-512 (since glibc 2.7)

So $5$salt$encrypted is an SHA-256 encoded password and $6$salt$encrypted is
an SHA-512 encoded one.

"salt" stands for the up to 16 characters following "$id$" in the salt.  The
encrypted part of the password string is the actual computed password.  The
size of this string is fixed:

MD5     | 22 characters
SHA-256 | 43 characters
SHA-512 | 86 characters

The characters in "salt" and "encrypted" are drawn from the set [a-zA-Z0-9./].
In the MD5 and SHA implementations the entire key is significant (instead of
only the first 8 bytes in DES).

Você ainda pode usar senhas md5 no arquivo shadow em sistemas que são padrão para o sha-512 ou outra coisa. O comando como ferramenta pode ser usado para gerar um hash MD5.

Você pode usar o mkpasswd que estranhamente faz parte do pacote whois no Debian / Ubuntu. %código%. (Encontrado aqui )

    
por 14.04.2011 / 19:19