Uwe: "Paßwort vrefällt..." per Mail?

Hallo zusammen,

man kann unter Linux ja einstellen, daß ein Paßwort generell nach x Tagen geändert werden soll.

Meine Frage ist nun, ob man anstelle, daß man den Hinweis nur per Login sieht, das auch per Mail y Tage vorher versenden kann.
Viele User benutzen ja nur Mail, haben mit einer Shell aber wenig am Hut.... :-)

Gibt es da schon im System etwas bzw. gibt es einen rel. einfachen Pipe, den man per Cron absetzen könnte?

Vielen Dank!

Uwe

  1. take this quelle: http://groups.google.de/groups?q=password+expires+mail+linux&hl=de&lr=&ie=UTF-8&oe=UTF-8&selm=mumfordDsI63B.5ox%40netcom.com&rnum=5 next time: ask google

    #!/usr/bin/perl

    open(SHADOW, "/etc/shadow") || die "Can't open /etc/shadow";

    $days = int(time() / 86400);    # days since Jan 1, 1970

    while(<SHADOW>) {   $user = (split(/:/))[0];   $exp = (split(/:/))[7];

    next if $exp == "";

    if($days + 13 ge $exp) {      # 14 = 2 weeks to start warning     $fudge = "";

    $diff = $exp - $days;     $fudge = "s" if $diff ne 1;

    # remove these two lines if you don't want root getting mail.     open(MAIL, "|/bin/mail root -s "Password expiration notification for $user:  $diff day$fudge left"") || die "Cannot pipe     close(MAIL);

    if($diff eq 0) {       open(MAIL, "|/bin/mail $user -s "Your Password expires today"") || die "Cannot pipe to mail";

    print MAIL "Your Password will expire TODAY!\n";       print MAIL "\nPlease change it.\n";

    close(MAIL);

    next;     }

    open(MAIL, "|/bin/mail $user -s "Warning:  Password Expiration"") || die "Cannot pipe to mail";

    print MAIL "Warning, your password will expire in $diff day$fudge\n";   }

    1. Danke!
      Ganz war es nicht richtig, habe es aber geschafft!
      Super!!!

      1. respekt und glückwunsch fürs skript umstricken ;-)

        p.s. google ist dein freund