Как проверить, была ли создана учетная запись unix с «--отключенным -логином» и «---отключенным -паролем»

Другие методы не работают, но этот работает (на Ubuntu по крайней мере):

while true; do
    ip route | grep "linkdown"
    if [ $? -eq 0 ]; then
        sleep 1  # network not yet up
    else
        break   # network up
    fi
done
3
26.02.2021, 16:52
1 ответ

Эту информацию можно собрать с помощью утилиты passwd.

Изman passwd

-S, --status

Display account status information. The status information consists of 7 fields. The first field is the user's login name. The second field indicates if the user account has a locked password (L), has no password (NP), or has a usable password (P). The third field gives the date of the last password change. The next four fields are the minimum age, maximum age, warning period, and inactivity period for the password. These ages are expressed in days.

Чтобы проверить статус каждого пользователя в системе, запустите

passwd -a -S

Отключенный (заблокированный )пользователь может выглядеть так:

apache L 08/30/2019 0 99999 7 -1

Обратите внимание на L, указывающий на то, что учетная запись заблокирована.

Обычный пользователь может выглядеть так:

panki P 09/23/2019 0 99999 7 -1
4
18.03.2021, 22:28

Теги

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