mlebel has asked for the wisdom of the Perl Monks concerning the following question:

Hello everyone, after searching for an answer to this and only finding something that seemed only for 'scp', I wonder if It can be done with net::openssh. I know it is a bad idea to keep passwords inside scripts or config files therefore I need a better way to handle this.

My question is this: Is it possible to use /etc/passwd to provide the password to login to ssh sessions using net::openssh? If so, how would one go about this?

I am aware that I can use public key's to make this happen but I would find it easier to use /etc/passwd instead.

Any suggestions?

Thanks, Marc

Replies are listed 'Best First'.
Re: NET::OpenSSH and /etc/passwd
by cursion (Pilgrim) on Apr 18, 2012 at 17:39 UTC

    You don't need to mess with passwords. Set up a password-less login with ssh via some page like this:
    http://www.linuxproblem.org/art_9.html

Re: NET::OpenSSH and /etc/passwd
by zwon (Abbot) on Apr 18, 2012 at 17:31 UTC
    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.
Re: NET::OpenSSH and /etc/passwd
by mlebel (Hermit) on Apr 18, 2012 at 18:38 UTC

    Thank you both for your explanation and clarification. I have reviewed the link and I will be proceeding with that method.

    Cheers