Help with shell scripts

sigmend

[H]ard|Gawd
Joined
Aug 6, 2003
Messages
1,303
I am trying to reset a password using a shell script.
The commands I am running requires a input. (sudo and passwd)
How can I pass input to the commands I am running?
I am checking my scripting books, but I thought that someone on here could help.
 
Let me better explain what I am trying to do.
At my school, all the students have laptops. (mac)
One of the dumbass teachers gave out the root password :rolleyes:.
What I can do is force a package to install on their computers
This package will contain a shell script that by itself will change the root password.
So I need it totally automated, no user action involved
 
IIRC, the passwd program flushes input & forces reads to come from a console...

I'm not sure how OSX stores its passwords, but if, like in LInux systems, they're in /etc/passwd or /etc/shadow you could perform a direct manipulation on that file relatively easy, since it's just plain text with a simple-to-parse format.
 
Could I pipe some text to it?
How would I do something like that?
I have done it in dos, but not in nix... Help?
 
the passwd program flushes input & forces reads to come from a console.

So, short of rewriting the passwd utility, you're going to have to find another way of doing it.
 
Back
Top