Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 May 2002 11:34:07 -0700 (PDT)
From:      Jeff Jirsa <jeff@boris.st.hmc.edu>
To:        Kirk Strauser <kirk@strauser.com>
Cc:        <freebsd-questions@freebsd.org>
Subject:   Re: How to force one user to change his password?
Message-ID:  <20020522113005.X36741-100000@boris.st.hmc.edu>
In-Reply-To: <873cwkte33.fsf@strauser.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On 22 May 2002, Kirk Strauser wrote:

>
>
> Add this near the top of their .bashrc (or other shell startup script):
>
>   passwd
>   if [ $? != 0 ]; then
>   	echo "Change your password.  I mean it."
>         exit
>   fi
>
> Your user will *have* to change their password everytime he they log in
> until they get wise to it.  Re-apply as necessary.

I haven't checked, but I suppose that'll work well, if you like the BOFH
approach. If you just want to force them to change it, backup one of the
startup scripts (script.bak), put the above code into one copy, and below
it, restore the original script after the change is complete:

   passwd
   if [ $? != 0 ]; then
       echo "Change your password.  I mean it."
         exit
   else
	mv [login-script.bak] [login-script]
   fi

Then you won't have to worry about him complaining that he has to change
his password daily, in case he's not smart enough to realize what had
happened.

- Jeff Jirsa


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020522113005.X36741-100000>