如何逃避@在Ant SCP任务 [英] How to escape @ in Ant SCP task
问题描述
我试图以许多方式逃避角色,但它不起作用。在以下示例中,我的用户名为user@host.com
< scp file =test.txttodir = & quot; user@host.com& quot;:password@ftp.host.com:/trust =truesftp =true/>
< scp file =test.txttodir ='user@host.com':password@ftp.host.com:/trust =truesftp =true/>
< scp file =test.txttodir =user\@host.com:password@ftp.host.com:/trust =truesftp =true/>
但输出总是相同的:
用户user的密码和密钥文件均不能被授予,无法验证
请问有没有强制任务解决这个字符串?非常感谢。
顺便说一下,我不知道为什么,但是与目前的提供商不可能创建一个用户名而不附加主机名。
我使用SCP任务我的build.xml和它的形式如下所示:
< scp file =package / ROOT.wartodir = user@example.com:〜trust =truepassword =$ {password}/>
// user:password @host:/ path符号
//最后一个@之前的所有内容最后一个:被认为是
//密码。 (所以如果路径包含一个@和a:它将不起作用)
代码不似乎支持这个评论(正如
martin clayton 所指出的)。您还可以看到当您的密码或密钥文件丢失时触发的错误。也许在 user:password @ host:/ path
符号和带有@的用户名之间的密码组合会导致问题?
I would like to ask you for some help. How can I use an scp task when my username contains an @ sign?
I tried to escape the character in many ways but it isn't working. In the following example, my username is user@host.com
<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"/>
<scp file="test.txt" todir="user\@host.com:password@ftp.host.com:/" trust="true" sftp="true"/>
But the output is always the same:
neither password nor keyfile for user "user has been given. Can't authenticate.
Please, is there anyway to force the task to parse this string correctly? Thank you very much.
By the way, I don't know why but with my current provider it is impossible to create a username without appending the hostname.
I use the SCP task in my build.xml and it's form looks like this:
<scp file="package/ROOT.war" todir="user@example.com:~" trust="true" password="${password}"/>
Looking at the source of the SCP Task at the function parseUri(String uri)
(line 370) it appears that the task can support a username with a @ symbol. The restrictions appear to be with paths that have a : or @ in them as seen by this comment:
// 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)
The code doesn't seem to support this comment (as pointed out by
martin clayton). You can also see the error you are referring which is triggered when the password or the keyfile is missing. Maybe the combination of a password in user:password@host:/path
notation and a username with an @ is causing problems?
这篇关于如何逃避@在Ant SCP任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!