Mac OS X, passwd, and keychain
You can use security set-keychain-password:

$ security set-keychain-password
Old Password:
New Password:
Retype New Password:
$ 


The password and keychain can also be specified as arguments:

security set-keychain-password -o oldpassword -p newpassword file.keychain