Baseado em testes:
-
é tratado como o fim da senha.passwd
- Espaços são permitidos. Embora não seja mostrado na saída abaixo, usando Ctrl V , eu pude usar Enter , Esc e outras chaves em uma senha.
$ pwgen 10 1
Pohhei8sai
$ passwd
Changing password for muru.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
$ printf 'Pohhei8sai\n$ printf 'testing 1\nUuxohv\a9moo\nUuxohv\a9moo\n' | passwd
Changing password for muru.
(current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
\b\n$ pwgen 10 1
Pohhei8sai
$ passwd
Changing password for muru.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
$ printf 'Pohhei8sai\n$ printf 'testing 1\nUuxohv\a9moo\nUuxohv\a9moo\n' | passwd
Changing password for muru.
(current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
\b\n%pre%\b' | passwd
Changing password for muru.
(current) UNIX password: Enter new UNIX password: Retype new UNIX password: No password supplied
Enter new UNIX password: Retype new UNIX password: passwd: Authentication token manipulation error
passwd: password unchanged
$ pwgen 10 1
Uuxohv9moo
$ printf 'Pohhei8sai\nUuxohvmoo\nUuxohvmoo\n' | passwd
Changing password for muru.
(current) UNIX password: Enter new UNIX password: Retype new UNIX password: Bad: new password is too simple
Enter new UNIX password: Retype new UNIX password: passwd: Authentication token manipulation error
passwd: password unchanged
$ printf 'Pohhei8sai\nUuxohv9moo\nUuxohv9moo\n' | passwd
Changing password for muru.
(current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
$ printf 'Uuxohv9moo\ntesting 1\ntesting 1' | passwd
Changing password for muru.
(current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
\b' | passwd
Changing password for muru.
(current) UNIX password: Enter new UNIX password: Retype new UNIX password: No password supplied
Enter new UNIX password: Retype new UNIX password: passwd: Authentication token manipulation error
passwd: password unchanged
$ pwgen 10 1
Uuxohv9moo
$ printf 'Pohhei8sai\nUuxohvmoo\nUuxohvmoo\n' | passwd
Changing password for muru.
(current) UNIX password: Enter new UNIX password: Retype new UNIX password: Bad: new password is too simple
Enter new UNIX password: Retype new UNIX password: passwd: Authentication token manipulation error
passwd: password unchanged
$ printf 'Pohhei8sai\nUuxohv9moo\nUuxohv9moo\n' | passwd
Changing password for muru.
(current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
$ printf 'Uuxohv9moo\ntesting 1\ntesting 1' | passwd
Changing password for muru.
(current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
De minha leitura de a fonte , a% O comandogetpass
usa a função (obsoleta) read -s
, que se comporta bem muito parecido com
(e marca o final da string de senha com %code% ). Não restringe os caracteres utilizáveis, além de algumas verificações de reutilização e complexidade. %code% não pode ser usado, pois é tratado como o marcador de fim de string normal em strings C, mas praticamente qualquer outra coisa pode, como o sino: %code%