views:

488

answers:

1

I need to be able to change a user's password from a cron task or from an ssh session. Is there an easy way to do that with a bash script? If not, what's the easiest way to do it in Cocoa?

+1  A: 

Use the passwd shell command.

Mehrdad Afshari
Doesn't passwd block redirecting input? If it doesn't, you could do this but you'd have to write all three lines out to a file (original, new, new) and then redirect it, but I thought that wasn't supposed to work (for safety). Could be wrong.
Bill K
beware, passwd(1) does not change the password the the user's keychain!
hop