We use SSH with public key authentication for these exact cases and then you do not need to worry about a password prompt in your script. The only "catch" in the setup is you need to know what each side is running (e.g., OpenSSH or SSH.COM). The setup is slightly different for each and if you have a mixed environment, there are some translations of the key storage format that is necessary.
Tom Largent -----Original Message----- From: Linux on 390 Port [mailto:[EMAIL PROTECTED] On Behalf Of James Melin Sent: Tuesday, February 08, 2005 10:39 AM To: [email protected] Subject: Using ssh to execute a command on another system Got a question about ssh.... rexec provides an ability to execute a command on a remote system and pass the ID/Password on the command line. This prevents the session from prompting for a password. e.g: rexec -l username -p password hostname command the problem with rexec , of course, is that it is unsecure. ssh also allows command line invocation of a command on a remote system. This is good, in that it will do the authentication encrypted. What I do not know is how to do it all nice and neat from a script without being challenged for a password. What I am looking to do is to ssh to a specific linux, execute a command, capture the output of that command, parse that output and set some variables and write out a 'status page' html file. I do not know how to handle being asked for a password in a shell script. I've seen some stuff about the identity file, but that really isn't making sense to me either and certainly seems like overkill for what I'm doing. ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390
