что делает 'adduser - отключенный вход в систему' делает?

Вы не можете непосредственно распечатать коды ASCII при помощи printf "%c" $i как в C.

Необходимо сначала преобразовать десятичное значение меня в его восьмеричное значение, и затем необходимо распечатать его использование использования printf и помещение \ перед их соответствующими восьмеричными значениями.

Распечатать A, необходимо преобразовать десятичные 65 в восьмеричный, т.е. 101, и затем необходимо распечатать то восьмеричное значение как:

printf "\101\n"

Это распечатает A.

Таким образом, необходимо изменить его к:

for i in `seq 32 127`; do printf \\$(printf "%o" $i);done;

Но при помощи awk можно непосредственно распечатать как на языке C

awk 'BEGIN{for(i=32;i<=127;i++)printf "%c",i}';echo
16
21.10.2013, 02:48
2 ответа

Объяснение не хорошо документируется.

- отключенный вход в систему устанавливает пароль на !

Значения пароля

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

Примеры

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::::::

Википедия кратко покрывает это. Это появляется это * и! эффективно сделайте то же самое; препятствуйте тому, чтобы пользователь вошел в систему (но не от su'ing от другого пользователя)

17
27.01.2020, 19:48

Это частично обсуждено здесь в shadow страница справочника.

выборка

$ man shadow
...
...
encrypted password
     Refer to crypt(3) for details on how this string is interpreted.

     If the password field contains some string 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.

В зависимости от Вашей версии страницы справочника для adduser на это ссылаются там.

выборка adduser страница справочника

--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.
3
27.01.2020, 19:48

Теги

Похожие вопросы