Results 1 to 3 of 3

Thread: perl or shell script to change the password

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    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.

  2. #2
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,374
    Thanks
    17
    Thanked 754 Times in 496 Posts
    Rep Power
    10

    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...
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  3. #3
    Junior Member
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 13th October 2010, 08:17 PM
  2. Solaris Change User Password Using a Shell Script
    By vikas027 in forum Solaris/OpenSolaris
    Replies: 1
    Last Post: 13th June 2008, 11:06 PM
  3. Change root password using perl script?
    By Raj1 in forum Solaris/OpenSolaris
    Replies: 8
    Last Post: 13th June 2008, 11:01 PM
  4. let users change password using perl script?
    By james bond in forum Getting started tutorials
    Replies: 9
    Last Post: 24th May 2007, 10:32 PM
  5. Replies: 0
    Last Post: 20th December 2006, 02:36 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 39 40 41