I would suggest letting ssh generate this file for you. Login to the remote host and then run 'ssh localhost'. You will be prompted to accept the host key. After accepting the host key you will then be asked to authenticate. You can cancel the command at this point. You will then find a file in ~/.ssh/ called known_hosts. Copy this file back to your machine that you intend to run ant on and edit your build.xml to use this file for known hosts.
-Rob Anderson > -----Original Message----- > From: Rhino [mailto:[EMAIL PROTECTED] > Sent: Friday, October 08, 2004 4:34 PM > To: Ant Users List; [EMAIL PROTECTED] > Cc: ant-user > Subject: Re: Question re SSH2/Scp/Sshexec > > > > Are you *sure* that the SSH1 and SSH2 formats are the same for the > known_hosts file? According to the Ant Manual writeup for the > 'knownhosts' > parameter Scp (and Sshexec): > > --------- > This sets the known hosts file to use to validate the > identity of the remote > host. This must be a SSH2 format file. SSH1 format is not supported. > --------- > > On the assumption that you were right and the manual was > wrong, I went ahead > and created a knownhosts file that had the format cited in > your URL. I set > my 'trust' parameter to 'false' and set 'knownhosts' to point at the > location of the knownhosts file that I had created and set > Ant to -debug. > According to the output from my Scp step: > > -------------------------------------------------------- > Adding reference: eclipse.progress.monitor > > [scp] Using known hosts: > d:\eclipse\workspace\resume\xml\known_hosts.txt > > [scp] BUILD FAILED: D:\eclipse\workspace\Resume\xml\ssh.xml:78: > com.jcraft.jsch.JSchException: > java.lang.ArrayIndexOutOfBoundsException: 313 > > -------------------------------------------------------- > > It looks like it is finding the knownhosts file just fine but > it doesn't > seem to like what it finds there. > > I am satisfied that the knownhosts file was constructed > according to the > rules in the man page and I carefully copied the bits, > exponent, and modulus > from the ssh_host_key.pub file in the host's /etc/ssh > directory beside the > hostname. > > I'm really not sure if you're right and that the SSH1 and > SSH2 formats are > the same, despite the manual's remarks, or if they are > different. If you are > right and the formats are the same, then perhaps I have just > made a mistake > in creating the file, despite proceeding cautiously. > Otherwise, I'd love to > find some documentation for the SSH2 format and make the > necessary changes > so that I can get this working. > > Is there any way to be sure what the SSH2 format for the > knownhosts file is? > Even a categorical declaration in an authoritative source that the > knownhosts file format is the same for both SSH1 and SSH2 > would be useful to > know. > > Rhino > > ----- Original Message ----- > From: "Dale Anson" <[EMAIL PROTECTED]> > To: "Ant Users List" <[EMAIL PROTECTED]> > Cc: "ant-user" <[EMAIL PROTECTED]> > Sent: Friday, October 08, 2004 5:34 PM > Subject: Re: Question re SSH2/Scp/Sshexec > > > > I don't think there is any difference in format between > ssh1 and ssh2 > > known_hosts files. The details of the file format are in > the man pages > > for sshd(8), on line at > > > http://www.openbsd.org/cgi-bin/man.cgi?query=sshd&sektion=8&ar ch=&apropos=0&manpath=OpenBSD+Current > > > > > > Can anyone point me to an example of a knownhosts file that is in SSH2 > > format? > > > > According to the articles on the (optional) Scp and Sshexec tasks in the > > Ant Manual, both tasks can specify a file in the 'knownhosts' parameter > > and that file must be in SSH2 format. I'd like to create such a file but I > > haven't been able to find an example anywhere so that I know what to > > create. > > > > Also, how would I go about suggesting to the developer of these tasks that > > he include an example of the knownhosts file in the documentation for > > these two tasks? Otherwise, there are bound to be other people asking the > > same question time and time again. > > > > Rhino > > --- > > rhino1 AT sympatico DOT ca > > "There are two ways of constructing a software design. One way is to make > > it so simple that there are obviously no deficiencies. And the other way > > is to make it so complicated that there are no obvious deficiencies." - > > C.A.R. Hoare > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]