Macos Apache Ants sshexec任务和Mac OS X下的一个密码问题

Macos Apache Ants sshexec任务和Mac OS X下的一个密码问题,macos,ant,Macos,Ant,我想在Mac OS X下的Apache Ant中使用sshexec任务,如下所示: <!-- ... --> <target name="uname"> <sshexec host="${host}" keyfile="${user.home}/.ssh/id_rsa" username="${user}" command="uname -ar" /> </target> <!-- ... --> 玩过之后,我发现我必须将我的

我想在Mac OS X下的Apache Ant中使用sshexec任务,如下所示:

<!-- ... -->
<target name="uname">
    <sshexec host="${host}" keyfile="${user.home}/.ssh/id_rsa" username="${user}" command="uname -ar" />
</target>
<!-- ... -->
玩过之后,我发现我必须将我的密码短语作为参数“passphrase”添加到任务中:

<!-- ... -->
<target name="uname">
    <sshexec host="${host}" keyfile="${user.home}/.ssh/id_rsa" passphrase="my.secret.passpgrase" username="${user}" command="uname -ar" />
</target>
<!-- ... -->

但我已经完美地设置了MacOSX,将密码管理与我的钥匙链集成在一起。所以我不必每次都输入密码短语


sshexec和scp任务是否有办法使用存储在我的钥匙链中的短语?

我自己刚刚遇到了这个问题,并提出了另一个解决方案:从钥匙对中删除您的密码短语。jsch似乎无法访问本地密钥链,因此您要么将密码放在ant任务中,要么将其从密钥中删除。以下是如何删除它:

prompt% ssh-keygen -p
Enter file in which the key is (~/.ssh/id_rsa): <just hit return if the file printed before the prompt is your key file>
Enter old passphrase: <your current passphrase>
Key has comment '~/.ssh/id_rsa'
Enter new passphrase (empty for no passphrase): <hit return to remove the passphrase>
Enter same passphrase again: <hit return again>
Your identification has been saved with the new passphrase.
提示%ssh keygen-p
输入密钥所在的文件(~/.ssh/id\u rsa):
输入旧密码短语:
密钥有注释“~/.ssh/id\u rsa”
输入新密码短语(无密码短语为空):
再次输入相同的密码短语:
您的身份已使用新密码短语保存。
prompt% ssh-keygen -p
Enter file in which the key is (~/.ssh/id_rsa): <just hit return if the file printed before the prompt is your key file>
Enter old passphrase: <your current passphrase>
Key has comment '~/.ssh/id_rsa'
Enter new passphrase (empty for no passphrase): <hit return to remove the passphrase>
Enter same passphrase again: <hit return again>
Your identification has been saved with the new passphrase.