The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
editing sqlplus id@passwd in multiple scripts, users and directories Helmi UNIX for Dummies Questions & Answers 8 05-08-2007 09:02 PM
passwd in shell script corny Shell Programming and Scripting 8 10-02-2006 07:44 PM
Scripts for IDīs free in /etc/passwd oscar_acm Shell Programming and Scripting 2 11-15-2005 08:50 PM
Move command in the shell isnt executing... thumsup9 Shell Programming and Scripting 2 02-01-2005 05:50 PM
passwd command not working rahulrathod UNIX for Dummies Questions & Answers 5 12-09-2004 11:46 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-31-2003
Registered User
 

Join Date: Apr 2002
Posts: 53
Stumble this Post!
Why passwd isnt working in shell scripts?

I had to write a script to change my login password, and the script wasnt working fine. When I searched through the previous postings in this forum, I got the solution (using 'expect' tool).

But I would like to know why passwd command isnt working in scripts?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-31-2003
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,450
Stumble this Post!
passwd opens /dev/tty for reading. And it will read /dev/tty to obtain a password. Before it reads the terminal, it reconfigures it to turn off echo, so that the password cannot be seen as it is typed. If that reconfiguration fails, passwd will give up. And after it has the password, it turns echo back on. Operations like these simply require a terminal.

If that behavior is acceptable, then the passwd command does indeed work in scripts just fine. The "problem" is that people want the script to be able to supply the password rather than the user of the script. In that case, you need expect.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:28 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0