Results 1 to 3 of 3

Thread: Simple KSH script needed

  1. #1
    Administrator
    August Knights
    Chief Operations Officer


    "This place is like someone's memory of a town, and the memory is fading. "
    [AK]Squidly's Avatar
    Join Date
    May 2001
    Location
    Burlington, NJ
    Posts
    10,621

    Simple KSH script needed

    I thought I'd throw this out there in case any of you are real "shell script wizards". You'd probably be able to crank this out in a heartbeat.

    I'm using ksh. I need a script to do the following.

    Prompt for and accept YOUR password as input.
    Prompt for and accept a user id as input.
    Prompt for and accept a new user password as input.
    issue the following command: sudo /bin/passwd <userid>
    Respond to the request of that command for entry of passwords.

    The only "tricky" part is this...when you first issue the sudo /bin/passwd
    command on our system, it prompts you for YOUR password. Then it prompts for the user's new password, and it prompts you again for the user's new password (to verify). So the first time you issue the command you're typing in 3 passwords.

    If you issue the command again within a certain time period, you only have to enter the user's password (2x). The authorization to use the sudo command seems to linger for like 60 or 120 seconds or so, so if you have a mess of password changes to do you don't have to keep retyping your password.

    The prompts for each are different, so if the script can read the prompt, it can tell which password is required.

    For YOUR password the prompt is: Password:
    For Their new password the prompt is: New Password:
    For Their new password repeated the prompt is: Re-enter new password:

    The script should just provide whichever password (supplied by the user) that is appropriate at that time.

    I want any error messages (id doesn't exist, etc.) to continue to be echoed to the screen.

    Anyone got the mad skillz?

  2. #2
    Accept no substitutes. [AK]Bribo's Avatar
    Join Date
    Jun 2001
    Location
    Albany, NY
    Posts
    8,298
    We don't use "sudo" here. Looking for a way to test this without it.
    [AK]Bribo

    If you were a zombie and I had to kill you, I'd feel sad.

  3. #3
    Administrator
    August Knights
    Chief Operations Officer


    "This place is like someone's memory of a town, and the memory is fading. "
    [AK]Squidly's Avatar
    Join Date
    May 2001
    Location
    Burlington, NJ
    Posts
    10,621
    Quote Originally Posted by [AK]Bribo
    We don't use "sudo" here. Looking for a way to test this without it.
    If you've got something, I can test it and put the finishing touches on it here. I'm not completely inept at this stuff, just figured I might not have to go to the trouble of learning the language if someone is already a mastah.

Similar Threads

  1. Simple Web Page Authoring Guides
    By [AK]Clay in forum Technical Support
    Replies: 4
    Last Post: 04-18-2006, 07:34 AM
  2. Script to Delete a registry key?
    By [AK]Clay in forum Technical Support
    Replies: 9
    Last Post: 02-02-2004, 02:46 PM
  3. buddy way point script
    By Pixelsponge in forum Tribes Series
    Replies: 8
    Last Post: 09-03-2001, 03:00 PM

Posting Permissions

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