LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-14-2008, 04:36 PM   #1
hal8000b
Member
 
Registered: Mar 2001
Location: UK
Distribution: Mint, Arch, Debian7
Posts: 194

Rep: Reputation: 23
Bash script to reset admin password with chntpw


I'm trying to write a script that will automatically reset or blank a windows admin password.

The idea is to use chntpw point it at a SAM file and run
chntpw -l SAM
to list users, grep the admin or Administrator account and automaticly append an "*" to reset the password.

However, I dont think its possible to redirect an input into chntpw as
the command requires several y and n input responses, not just a single input.

Is there any way to pass multiple inputs into the chntpw command? Thanks in advance.
 
Old 12-14-2008, 05:22 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by hal8000b View Post
Is there any way to pass multiple inputs into the chntpw command?
Best chance would be an "expect" script AFAIK. Searching LQ for "expect script" should turn up some threads.


Quote:
Originally Posted by hal8000b View Post
I'm trying to write a script that will automatically reset or blank a windows admin password.
That's a nasty tool. Please make sure you build in some safeguard so it doesn't get used in anger easily :-]
 
Old 12-15-2008, 02:47 AM   #3
hal8000b
Member
 
Registered: Mar 2001
Location: UK
Distribution: Mint, Arch, Debian7
Posts: 194

Original Poster
Rep: Reputation: 23
Thank you, I found the expect home page, and good point, in the wrong hands it could be dangerous, so I'll include some sort of password or other security measure.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reset user password via script fluffyvoidbunny SUSE / openSUSE 8 03-10-2006 02:18 AM
How to reset admin username and password in fedora 3 Shanahan Linux - Newbie 5 05-11-2005 02:49 PM
webmin admin password reset partom *BSD 2 08-02-2004 05:19 AM
is there a program like chntpw - one that will tell me a forgotten password? haimeltjnfg General 9 06-01-2004 10:18 PM
MacOS X Experts: How to reset Admin password? Azmeen General 3 10-30-2003 08:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration