#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    3
    Rep Power
    0

    Password change ksh script not working...


    OK, I am new to FreeBSD and I am trying to use the chpass command in a scipt to change my passwords. I can use the "chpass -p 'encrypted password' userid" command to change the password, but it does not work within my script. The bigger problem is it DOES change the password, just not to what it should be... Any ideas???

    Thanks in advance!
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,648
    Rep Power
    4248
    Where are you calling this script from? Is it possible that PATH is not set in that environment and hence it is not finding chpass?

    Also, you're passing the encrypted password to the script, not the password to encrypt, correct?
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    3
    Rep Power
    0
    Originally Posted by Scorpions4ever
    Where are you calling this script from? Is it possible that PATH is not set in that environment and hence it is not finding chpass?

    Also, you're passing the encrypted password to the script, not the password to encrypt, correct?
    Thanks for the reply. Here are the answers:
    1.) Currently, I am just running it through a telnet session. I am using the same telnet session to issue the command successfully. Also, it is changing the password, just to something I do not know...

    2.) Yes, I am feeding the command the encrypted password. It is the same encrypted password I am feeding the command when successful on the telnet prompt.

    Also, I actually narrowed down the problem. I am getting the encrypted password from a file (which contains a list of passwords). This is what is causing the problem. If I do not use a variable for the encrypted password, it works properly. Anyone know how I can fix this? I really need to grab this information from another file.

    Thanks in advance!!!
    Last edited by DRiggs; July 7th, 2008 at 12:32 PM. Reason: More Information
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    3
    Rep Power
    0
    OK, I figured this out, so I thought I would post my solution for anyone else who is having this issue. I was using single quotes around the encrypted password since the password contained special characters ($,/, etc). Once I removed these single quotes the script is working fine. Thank you all for your help with this issue, and hopefully this post will help someone else.

IMN logo majestic logo threadwatch logo seochat tools logo