nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

perl or shell script to change the password

This is a discussion on perl or shell script to change the password within the Shell scripting forums, part of the Development/Scripting category; i want a perl or shell script so that the user of ftp can change their won password....


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 15-03-2009, 03:36 PM
Junior Member
User
 
Join Date: Mar 2009
OS: Debian
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
vivek rai is on a distinguished road
Default perl or shell script to change the password

i want a perl or shell script so that the user of ftp can change their won password.
Reply With Quote
  #2 (permalink)  
Old 15-03-2009, 07:47 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,709
Thanks: 11
Thanked 244 Times in 183 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Perl code:
Code:
#!/usr/bin/perl 
use Unix::PasswdFile;

$pw = new Unix::PasswdFile "/etc/passwd";
$pw->passwd("monk", $pw->encpass("My-New-Password"));
$pw->commit();
undef $pw;
See:
Change root password using perl script?

Shell script code:
Code:
 echo $PASSWORD | /usr/bin/passwd --stdin $USERNAME
Now, you can write your own logic...
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #3 (permalink)  
Old 15-03-2009, 10:51 PM
Junior Member
User
 
Join Date: Mar 2009
OS: Debian
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
vivek rai is on a distinguished road
Default

Thankyou,

i have another question, i am using proftpd and my password file is in different location /etc/proft.passwd and i need shell script to change that password without changing /etc/passwd file.
Reply With Quote
Reply

Tags
change password , passwd , perl , shell script


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Solaris Change User Password Using a Shell Script vikas027 Solaris/OpenSolaris 1 13-06-2008 11:06 PM
Change root password using perl script? Raj1 Solaris/OpenSolaris 8 13-06-2008 11:01 PM
let users change password using perl script? james bond Getting started tutorials 9 24-05-2007 10:32 PM
Shell script to change folder directory owner after restore marinm Shell scripting 5 23-01-2007 12:53 PM
HP UX user lock password, change password, password aging rockdalinux HP-UX 0 20-12-2006 02:36 PM


All times are GMT +5.5. The time now is 12:17 PM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38