System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create user that ask for passwd the first connection

SOLVED
Go to solution
Carme Torca
Super Advisor

How to create user that ask for passwd the first connection

Hi,

I want to create an user and that the first time that it connects to the server the server ask for the passwd, and the user put the passwd that it wants.

How could I do this whith useradd and what options???

Thanks!
Carmen.
Users are not too bad ;-)
5 REPLIES
Roberto Polli
Trusted Contributor

Re: How to create user that ask for passwd the first connection

You should make a script and put it in /etc/profile. This script should check if a particular file exists (eg. /home/newuser/.firstlogin) and then executes the passwd program.

script file or code should be something like that

...
if [ -f $HOME/.firstlogin ]; then
if passwd then;
rm -f $HOME/.firstlogin
fi
fi
...


Sure you have to create /home/user/.firstlogin
when you create the user

Hope it helps.
Peace, R>
Carme Torca
Super Advisor

Re: How to create user that ask for passwd the first connection

Thanks!,

but I need to put first one passwd... I would like that the first time it ask me for the passwd.... something like that:

login: XXXXXXX
Your password has expired. Choose a new one
Changing password for perform
New password:

Thanks!!
Carmen.
Users are not too bad ;-)
Roberto Polli
Trusted Contributor
Solution

Re: How to create user that ask for passwd the first connection

To do this you should install the enhanced security, as specified in
man login

Look at there and you'll probably find the answer.

Peace, R.
Ann Majeske
Honored Contributor

Re: How to create user that ask for passwd the first connection

There's information on setting up and using Enhanced Security in the Security manual (or Security Administration manual for V5.1B)

Ann
Stuart Green
Frequent Advisor

Re: How to create user that ask for passwd the first connection

There is at least this option within Enhanced Security.

Tru64 : C2 Security : How to Force Password Change at Next Login

The user account entry in the password protected database needs to have present the keyword field identifier:
:u_psw_change_reqd:

This can be applied through the usermod program

# usermod -x passwd_must_change=1