que fait `adduser –disabled-login`?

Un document d'installation que je suis suit indique d'append un user comme ceci:

sudo adduser --disabled-login --gecos 'GitLab' git 

L' --disabled-login est absent de la plupart des pages man que j'ai recherchées.

J'ai fait deux users, l'un avec le --disabled-login ( foo ), et l'autre sans ( git ).

Pour autant que je peux dire le drapeau --disabled-login ne fait rien. Je peux encore su aux deux users, et les deux utilisent /bin/bash comme leur shell de connection.

La seule différence que je peux voir est que getent passwd a des virgules supplémentaires avant le dossier de départ sur l'user dont la connection est désactivée. Il n'y a pas de documentation que je puisse find pour indiquer ce que cela signifierait.

 root@gitlab:~# getent passwd git git:x:998:998:GitLab:/home/git:/bin/bash root@gitlab:~# getent passwd foo foo:x:1001:1002:GitLab,,,:/home/foo:/bin/bash 

MISE À JOUR # 1

J'ai trouvé une autre différence, un user a un * comme mot de passe, l'autre a ! :

 root@gitlab:~# getent shadow git git:*:15998:::::: root@gitlab:~# getent shadow foo foo:!:15998:0:99999:7::: 

Que fait exactement --disabled-login sur Ubuntu?

L'explication n'est pas bien documentée.

–disabled-login définit le mot de passe !

Valeurs mot de passe

 NP or null = The account has no password * = The account is deactivated & locked ! = The login is deactivated, user will be unable to login !! = The password has expired 

Exemples

 root@gitlab:~# getent shadow vagrant vagrant:$6$abcdefghijklmnopqrstuvwxyz/:15805:0:99999:7::: root@gitlab:~# getent shadow foo foo:!:15998:0:99999:7::: root@gitlab:~# getent shadow git git:*:15998:::::: 

wikipedia couvre brièvement ceci. Il semble que * et! effectivement faire la même chose; empêcher l'user de se connecter (mais pas de su'ing d'un user différent)

C'est partiellement discuté ici dans la page de man shadow .

extrait

 $ man shadow ... ... encrypted password Refer to crypt(3) for details on how this ssortingng is interpreted. If the password field contains some ssortingng that is not a valid result of crypt(3), for instance ! or *, the user will not be able to use a unix password to log in (but the user may log in the system by other means). This field may be empty, in which case no passwords are required to authenticate as the specified login name. However, some applications which read the /etc/shadow file may decide not to permit any access at all if the password field is empty. A password field which starts with a exclamation mark means that the password is locked. The remaining characters on the line represent the password field before the password was locked. 

Selon votre version de la page man pour adduser il y est référencé.

Extrait adduser man page

 --disabled-login Do not run passwd to set the password. The user won't be able to use her account until the password is set. --disabled-password Like --disabled-login, but logins are still possible (for exam- ple using SSH RSA keys) but not using password authentication.