How to force user to change password at login? | Unix Linux Forums | UNIX for Advanced & Expert Users

  Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

How to force user to change password at login?

UNIX for Advanced & Expert Users


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-08-2002
penguin-friend
Guest
 
Posts: n/a
Error How to force user to change password at login?

Hi all!

In order to reinforce security on some uxix boxes, i'd like to force users to change their passwd at next login.
I found out how to do it under HP-UX ( by changing their passwd field in the /etc/passwd by ",..".How can i acheive the same thing under Sun ( 2.6, and 2.8)?

Thanx
Sponsored Links
    #2  
Old 07-08-2002
janr janr is offline
Registered User
 
Join Date: Jun 2002
Last Activity: 19 May 2003, 10:43 AM EDT
Location: Amsterdam (Netherlands)
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
admin tool

I beleive you can do this by the admintool
Sponsored Links
    #3  
Old 07-08-2002
penguin-friend
Guest
 
Posts: n/a
To heavy for what I want!

janr,

Thanx for your answer, but when I said some "unix boxes", I mean over 400 servers, and about 50 accounts on each server!
I'm looking for a way to do it in a shell script and put that in a batch on each server!

Any other ideas?
    #4  
Old 07-08-2002
wael wael is offline
Registered User
 
Join Date: Mar 2002
Last Activity: 6 April 2003, 9:13 AM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Tools

Hi,

This very easy , just use the command
# passwd -f <user-Name>
with -f the system wil force any login user to change his password

You can put this in a script like

#!/bin/ksh

IFS=':'

while read a b c d e f g
do
passwd -f $a

done < /tmp/passwd_file_copy

IMP: before you run this script copy the passwd file to the /tmp
with name passwd_file_copy and remove from it the users that will not change the passwd for them like root, sys ..
you can do this by the grep command

Note: I DID NOT TEST THIS SCRIPT pls. run it on one system before using it in all systems

Good luck

Eng. Wael
Sponsored Links
    #5  
Old 07-08-2002
penguin-friend
Guest
 
Posts: n/a
Well, i guess there is another problem you need to know about!

In fact, I'm setting up a replacement of the classic passwd command, via NPASSWD. The equivalent of the "-f" for npasswd could be "-XI".
This permits an interactive passwd only for root. I have found a way to change a password via a script, but not how to force the change

I understand your script, but I cannot see how your exemple forces users to change their password at their next login. Could you explain?
Sponsored Links
    #6  
Old 07-08-2002
RTM's Avatar
RTM RTM is offline Forum Advisor  
Registered User
 
Join Date: Apr 2002
Last Activity: 17 October 2014, 8:46 PM EDT
Location: On my motorcycle
Posts: 3,093
Thanks: 1
Thanked 31 Times in 9 Posts
His script works because of the passwd option -f. From the man page on passwd,

Privileged User Options
Only a privileged user can use the following options:

-f Forces the user to change password at the next login
by expiring the password for name.

-l Locks password entry for name.


Of course, this works on local accounts only - will not work if you are using NIS. NIS won't allow forcing (although somehow it will under admintool).

If you are using NIS+ you can force it but I believe it's either a different command or different syntax. Not sure.
Sponsored Links
    #7  
Old 07-08-2002
penguin-friend
Guest
 
Posts: n/a
I wasn't clear in my last post...

I meant to say how does the script work, and how to make it function at login?
I understand the -f option. My question concerns more the concept of the script rather than the script itself..
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to force a user to change the password uxadmin007 Red Hat 8 10-07-2009 05:06 PM
Force user to change passwd on first login saurabh84g Solaris 7 06-17-2009 10:05 AM
force to change password(shell script) tjay83 Shell Programming and Scripting 3 09-18-2008 11:16 PM
Force to change to a different password champion UNIX for Advanced & Expert Users 3 01-16-2003 12:01 PM
Force Password Change...RedHat 7.1 vancouver_joe UNIX for Advanced & Expert Users 1 02-22-2002 01:12 AM



All times are GMT -4. The time now is 11:45 PM.