in reply to NET::OpenSSH and /etc/passwd
No, it is not possible. /etc/passwd doesn't contain any passwords, /etc/shadow contains passwords' hashes which can't be used instead of passwords. You can store the password in a config file, or inside your script, though as you already know a better idea is to use public keys.