RHELの「passwd -sa」と同じですか?

RHELの「passwd -sa」と同じですか?

この質問をするのは少し愚かですが、Solarisでは、/ etc / passwdのすべてのユーザーのステータス情報を印刷することを除いて、passwd -sa(やや)同じ出力を提供するコマンドを実行できます。passwd -S userName同等のGNU / Linuxコマンドは何ですか?

私は他の人がサーバーの基準を設定できるように、簡単な指示を作成したいと思います。そのうちのいくつかは、すべてのアカウントに設定されたパスワードの有効期限を識別するものです。 forループを使用できますが、cut -f1 -d: /etc/passwd彼に簡単なコマンドを出すことができたらと思います。

答え1

-aRHEL / CentOSにはpasswdオプションはありませんが、-Sオプションがあります。したがって、次の行をrootとして実行します。

  for user in `awk -F: '{print $1}' /etc/passwd`; do passwd -S $user; done

または

  for user in $(awk -F: '{print $1}' /etc/passwd); do passwd -S $user; done

答え2

少なくとも私が持っているArch LinuxのShadow-utils 4.1.5.1では、ステータス-aも印刷します。passwd -Sa好きなようにしそうです。からman passwd

   -a, --all
       This option can be used only with -S and causes show status for all users.
   -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 -Sa
root P 05/07/2013 -1 -1 -1 -1
bin P 09/19/2010 -1 -1 -1 -1
daemon P 09/19/2010 -1 -1 -1 -1
mail P 09/19/2010 -1 -1 -1 -1
ftp P 09/19/2010 -1 -1 -1 -1
http P 09/19/2010 -1 -1 -1 -1
uuidd P 09/19/2010 -1 -1 -1 -1
dbus P 09/19/2010 -1 -1 -1 -1
nobody P 09/19/2010 -1 -1 -1 -1
git L 05/07/2013 -1 -1 -1 -1
chris P 05/07/2013 0 99999 7 -1
avahi L 05/07/2013 -1 -1 -1 -1
mpd L 05/07/2013 -1 -1 -1 -1
ntp L 05/07/2013 0 99999 7 -1
nullmail L 05/13/2013 -1 -1 -1 -1
polkitd L 05/14/2013 0 99999 7 -1

関連情報