Linux / UNIX Tech Support Forum
This is a discussion on Change root password using perl script? within the Solaris/OpenSolaris forums, part of the UNIX operating systems category; I would like to change password using perl script... any idea how to do it? -Raj...
|
|||||||
| Solaris/OpenSolaris Discuss all about the SUN Solairs/OpenSolaris. You are free to talk about any issues related to Solaris administration, networking, services and other stuff, share information or ask doubts. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
| Sponsored Links | ||
|
|
|
||||
|
You really don't need a perl script. All you need is following shell script and expect tool:
Code:
vi npasswd Code:
#!/bin/sh
# \
exec expect -f "$0" ${1+"$@"}
set password [lindex $argv 1]
spawn passwd [lindex $argv 0]
expect "assword:"
send "$password\r"
expect "assword:"
send "$password\r"
expect eof
Code:
npasswd vivek 123456 npasswd : script name vivek : username 123456: Newpassword Script must be run as a root user, it can be call from perl, php or any other lanauge. Download expect tool here: http://expect.nist.gov/
__________________
Vivek Gite Linux Evangelist |
|
|||
|
Hi i download expect and Tcl and store it in the path /usr/local/src.
But while run ./configure file, it was unable to detect the Tcl file.. How to install the expect..? |
|
|||
|
Quote:
Hi Monk, Can you pls tell me how to run this script. I am completely nuts abt perl. THanks, VIKAS |
|
||||
|
You need to have perl installed. You also need to have Unix::PasswdFile cpan module installed on Solaris UNIX. This can be done using package manager.
__________________
Vivek Gite Linux Evangelist |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to change root password | sandromax | Solaris/OpenSolaris | 4 | 11-10-2007 02:43 AM |
| let users change password using perl script? | james bond | Getting started tutorials | 9 | 24-05-2007 10:32 PM |
| Change root password MySQL 5 | chiku | Databases servers | 1 | 16-01-2007 08:46 PM |
| HP UX user lock password, change password, password aging | rockdalinux | HP-UX | 0 | 20-12-2006 02:36 PM |
| How to Change Password | puppen | Linux software | 6 | 06-06-2006 01:56 PM |