Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Ant SCP任务中逃逸@_Ant_Escaping_Sftp_Scp - Fatal编程技术网

如何在Ant SCP任务中逃逸@

如何在Ant SCP任务中逃逸@,ant,escaping,sftp,scp,Ant,Escaping,Sftp,Scp,我想请你帮忙。当我的用户名包含@符号时,如何使用scp任务 我试着用很多方法摆脱这个角色,但都不管用。在下面的示例中,我的用户名是user@host.com <scp file="test.txt" todir="&quot;user@host.com&quot;:password@ftp.host.com:/" trust="true" sftp="true"/> <scp file="test.txt" todir="'user@host.com':pass

我想请你帮忙。当我的用户名包含@符号时,如何使用scp任务

我试着用很多方法摆脱这个角色,但都不管用。在下面的示例中,我的用户名是user@host.com

<scp file="test.txt" todir="&quot;user@host.com&quot;:password@ftp.host.com:/" trust="true" sftp="true"/>
<scp file="test.txt" todir="'user@host.com':password@ftp.host.com:/" trust="true" sftp="true"/>
<scp file="test.txt" todir="user\@host.com:password@ftp.host.com:/" trust="true" sftp="true"/>
请问,是否仍有强制任务正确解析此字符串的方法?多谢各位


顺便说一句,我不知道为什么,但对于我当前的提供商来说,不添加主机名就无法创建用户名。

我在build.xml中使用SCP任务,其形式如下:

<scp file="package/ROOT.war" todir="user@example.com:~" trust="true" password="${password}"/>
代码似乎不支持此注释(正如
)。您还可以看到所引用的错误,该错误在密码或密钥文件丢失时触发。可能是
用户中密码的组合:password@host:/path
符号和带有@的用户名导致问题?

当前ant版本
-1.9.4
操作系统:-
16.04 Ubuntu
无法工作

更改为
1.9.3
并指向
/usr/bin/ant
ssh成功 观察:

16.04 and ant 1.9.3 is working
14.04 ant 1.9.4 is working

嗨,谢谢你的回答。我确信我的用户名包含@符号。我现在只有窗户了。但是,当我使用任何GUI应用程序(如WinSCP或TotalCommander)时,连接都可以工作。是的,我必须使用SFTP连接而不是SCP。我阅读了文档(),密码可以双向传递。但这两种方式都不起作用,当我通过TC连接时,我在标题中看到:user@host.com@ftp.host.com此线程讨论与旧版本的scp和sftp以及其中包含@符号的用户名不兼容的问题。他们提出用\@逃跑或升级服务器。这些有帮助吗?谢谢你的评论。我找到了这个论坛,并尝试了这些逃跑的可能性(在问题中提到),但它们不起作用。我认为我在服务器端没有问题。我可以和其他客户联系。我认为是Ant scp客户端错误地解析了它。现在我得到了这个错误:java.net.UnknownHostException:host。com@ftp.host.com,但主机只是ftp.host.com。在我看来,它就像一个蚂蚁虫。您引用的注释上方的一行显示错误-它假定uri中的第一个冒号始终位于第一个@之前,但当@出现在用户名中时,情况并非如此。if中的备用逻辑也不支持这种情况。需要重写一下。
// user:password@host:/path notation
// everything upto the last @ before the last : is considered
// password. (so if the path contains an @ and a : it will not work)
16.04 and ant 1.9.3 is working
14.04 ant 1.9.4 is working