UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old August 25th, 2004, 03:13 AM
melinda melinda is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 76 melinda User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 56 m
Reputation Power: 5
script to change userID password

I have a file contain userID's and require to set inital password for all userId's in the file using pwdadm command.
When I run my script it prompt me with enter New password
please note pwdadm does not have option such as
pwdadm $name $passwd
it only works with pwdadm $name then it prompts for entering the new password.
What is wrong with my script


cat password.txt|while read name
do
pwdadm $name
echo newpaswd123 ###Assign new password
done

Reply With Quote
  #2  
Old August 25th, 2004, 05:34 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 44 m 45 sec
Reputation Power: 9
try read a good shell book first ?

Reply With Quote
  #3  
Old August 25th, 2004, 06:21 PM
melinda melinda is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 76 melinda User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 56 m
Reputation Power: 5
Yes Thank you for advise
Can any one help

Reply With Quote
  #4  
Old August 26th, 2004, 03:12 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 44 m 45 sec
Reputation Power: 9
if so, you sure realized:

a) while read name =
read in $name a string until a blanc is encountered, you don't
check the IFS nor the input-strings, this works
only (and is an assumption) if pwd.txt contains:
userA
userB
..
userX

nota, i prefer the syntax:

for name in `cat file`
do
...
done

2) pwdadm $name
i don't know this prog, but i suppose it expect an user-name
AND an input (maybe with confirmation)

3) echo newpaswd123
prints on standard-output (also mostly tty) the string new...
this is NOT the input of 'pwdadm'

4) in *nix, only the first 8 chars are significant, so
newpaswd123 and newpaswd999 ARE the same.

----------------

i see two way to do it
1) install and use 'expect'
2) manually crypt the newpwd, replace the crypted pwd in
/etc/[passwd|shadow] or nis-table and hope it works.
(using the right tool, a child's play)

Reply With Quote
  #5  
Old August 26th, 2004, 09:16 AM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,307 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 28 m 57 sec
Reputation Power: 48
expect is available as part of gnu utils. If you don't have expect (a very good solution to your problem) - and I am not familair with pwdadm either because as I remember it's an AIX thing - you need to give us a sample session for one user.

On a lot of systems, sysadmins use passwd to alter passwords for user accounts - I assume you can do that on AIX as well?

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > script to change userID password


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway