Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: b1ackmai1er on February 11, 2011, 10:41:01 PM

Title: setting password though script
Post by: b1ackmai1er on February 11, 2011, 10:41:01 PM
Hi,

I want to change my password through a script:

tried this but it didn't work. Can anyone see the mistake I am making?

tc@box:/mnt/sda1$ echo '123asimov$$$' ; echo '123asimov$$$' | sudo passwd tc
123asimov$$$
Changing password for tc
New password:
Retype password:
Passwords don't match
passwd: password for tc is unchanged

Thanks.
Title: Re: setting password though script
Post by: roberts on February 11, 2011, 11:07:50 PM
You can see an example of how I did it in /etc/init.d/tc-config using chpasswd

 echo "$USER:$PASSWD" | chpasswd
Title: Re: setting password though script
Post by: b1ackmai1er on February 12, 2011, 05:25:17 PM

HI that works great!


Still would be interested to know how to do this using pipes/redirectiohiln as I wish to use the same techniques for smbpasswd as well.

I saw a script somewhere that showed the password being redirected to the program from a file but cannot find it. It was not as simple as sudo smbpasswd -a user < passfile.txt

regards b1ackmai1er