in reply to rlogin

For rlogin, I would recommend looking into Net::Netrc. FTP is more straightforward. Simply include the password as a paramater to a Net::FTP object.