Automatic script to change the UNIX Password

Thread Tools Search this Thread
Operating Systems HP-UX Automatic script to change the UNIX Password
# 1  
Old 08-10-2013
Automatic script to change the UNIX Password


we have around 50 users and every month we need to change the password manually once its expire.

do we have any script to change the password automatically.


Thanks in advance..
# 2  
Old 08-12-2013
Do you mean that you personally have 50 user accounts, or you have 50 users and you want to force their accounts to change? There are settings in the OS that will force account password expiry so they will have to pick a new one next time they log in, however FTP will fail until a valid password change has been completed.

There are parameters that you can set through sam for this sort of thing, but I can't remember where the file is that stores them.

Can you explain what you are trying to achieve?

# 3  
Old 08-14-2013
Hi Robin,

we have one server, in that we have more than 20 users.
we are trying to do the password change for all the users before its getting disable.

like we are trying to crate the automatic password script that we can configure in crontab in each user.

so we might not end up in password expired situation.

# 4  
Old 08-14-2013
So when the password expires, does it not prompt for a new one? What happens at next login? Surely the user is prompted for a new password then because you have set it for them.

If you are looking to automate a new password setting, how will the user know their password? E-mail perhaps? Well, that's open to attack, snooping etc. so I would avoid it.

What are the password ageing settings you currently have in place? Are you actually expiring the user account rather than the password perhaps?

Let's have a think.

# 5  
Old 08-14-2013
Once the password expires it will ask for new password when the user logging next time and he can able to change.

The issue is our user account is getting locked if someone change the password to other password.

So we are planning to change the password automatically before it expires.


1) the above command will ask for old password
2) then this will ask for new password
3) confirm the new password.

4) again we need to type passwd command to do the password change
5) and need to set to old password

we are planning to autoamte the same in UNIX shell scriping and planning to place the same in crontab of each user with some time period (may be 55 days once)

so that password will get changed before it expires and hope no one will try to change the password.

Do you think is there anyway to automate such scenario - your suggestion please ?
# 6  
Old 08-14-2013
Why not simply use passwords that dont expire then?
# 7  
Old 08-15-2013
Dear Manivasagam,

Does this mean that you have several people sharing a user account? If so, I could see that if one user changes the password and the others don't find out then they could suspend the account. You could issue them with their own account each to get past that one. If they really really really need to share the account, you could write a sudo rule that allows them to switch user to it and code their .profile to do so, then exit on the return. It would also give you some logging of who is using the system.

If these are already individual accounts, I'm a bit confused why if the user chooses their own when the password naturally expires, that it locks. Do they just not remember that they have changed it?

Can you explain more what is actually happening?

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Forum Support Area for Unregistered Users & Account Problems

Password sent via reset password email is 'weak' and won't allow me to change my password

I was unable to login and so used the "Forgotten Password' process. I was sent a NEWLY-PROVIDED password and a link through which my password could be changed. The NEWLY-PROVIDED password allowed me to login. Following the provided link I attempted to update my password to one of my own... (1 Reply)
Discussion started by: Rich Marton
1 Replies

2. Shell Programming and Scripting

Shell script to change the password

Hi Folks, I am trying to change the password for the user "sysservice" Where my requirement is login to each server and exit from that and ssh to the next server.. I have enabled the password less auth for the user sysservice. for i in `cat /home/sysservice/servers.txt` do ssh... (1 Reply)
Discussion started by: gsiva
1 Replies

3. Shell Programming and Scripting

Script to change password in UNIX

Hi Friends, Every morning i need to change the password, please advise how it can be automated. I am having pre planned password list for 4 months which can be used as input file for new passwords. Thanks (28 Replies)
Discussion started by: rajjev_saini123
28 Replies

4. Shell Programming and Scripting

Automatic su password entry script

Before I start, two things. 1) Yes I know it's bad practice and obomination to all things holy, but I'm not a sys admin at JP Morgan, I'm a hobbyist tooling about in a VM, in my pants, at home. 2) If you are just going to flame for even considering hardcoding a root password, thanks, I get... (2 Replies)
Discussion started by: 3therk1ll
2 Replies

5. Shell Programming and Scripting

Unix script to change password

Hello Gurus I have little challenge which I do not know how to address it. I have unix account on many servers (let's say over 25). These accounts expire every 60 days. Is there scripts that I can run from my "local computer" and pass a new password to it where it would change it for me on all... (7 Replies)
Discussion started by: nimo
7 Replies

6. UNIX for Dummies Questions & Answers

Where to change the UNIX password prompt?

Hi guys, I got these 3 servers: a, b and c which I ssh from a to b/c. a:$ ssh userid@b Password: a:$ ssh userid@c userid@c's password: Notice that the password prompt is different (highlighted in bold) on both servers even though their SUN Solaris version the same, OpenSSH version... (0 Replies)
Discussion started by: DrivesMeCrazy
0 Replies

7. Shell Programming and Scripting

how to change root password using shell script with standard password

Hi Friends. I am new to scripting now i want to change the root password using the script with standard password. which is the easy scripting to learn for the beginner, Thanks in advance. (2 Replies)
Discussion started by: kurva
2 Replies

8. Shell Programming and Scripting

Automatic FTP Script from windows to unix machine

Hi i need to FTP files from windows to unix(sun) machine using script. what are the scripts commands i need to use to transfer files Thanks (2 Replies)
Discussion started by: bmkreddy
2 Replies

9. Shell Programming and Scripting

Script to change UNIX password

My shop has just ordained that all UNIX passwords expire after 45 days. We do NOT have a "single logon" facility, so I will need to logon to each of the servers (15+) I interact with and change my password by hand. I thought I could invoke passwd inside a ksh script as a Here document and... (12 Replies)
Discussion started by: kornshellmaven
12 Replies

10. UNIX for Advanced & Expert Users

Change password script in Unix easily..

I have more than 50 server unix's password need to change, usually I assign one password for all hosts, for easy remember, but I need to change password every two's very tried to change password every 2 months, is there any unix script that can change password easily? ie ' script... (4 Replies)
Discussion started by: zp523444
4 Replies
Login or Register to Ask a Question