How to escape “@” in the username when logging in through FTPES with curl?

0

$ curl -T "index.html" -k --ftp-ssl -u "MYUSER@MYDOMAIN.COM" MYDOMAIN.COM
Enter host password for user 'MYUSER@MYDOMAIN.COM':


 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0 57173    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method PUT is not allowed for the URL /index.html.</p>
<hr>
<address>Apache/2.2.16 Server at MYDOMAIN.COM Port 80</address>
</body></html>
100 57480  100   307  100 57173    284  52902  0:00:01  0:00:01 --:--:-- 53633

Also posted on Stack Overflow

LanceBaynes

Posted 2011-01-11T09:54:20.057

Reputation: 3 510

2Cross-posting is a no-no. – John T – 2011-01-11T09:58:40.567

Answers

1

i sniffed it with wireshark:

curl --ftp-ssl -T "FILE.TXT" -k -u "MYUSER@MYDOMAIN.COM:MYPASSWORD" "ftp://MYDOMAIN.COM"

and this one uses ftps! :P it works perfectly! solved :)

thank you!

LanceBaynes

Posted 2011-01-11T09:54:20.057

Reputation: 3 510

1

The problem is not @ (you don't need to escape it), it's that you haven't told curl to use FTP in the first place. Note that you're receiving a HTTP response from a HTTP server.

cURL takes URLs, and if it encounters a bare mydomain.com it adds http:// automatically. Use curl ... ftps://mydomain.com (which enables --ftp-ssl automatically, by the way).

user1686

Posted 2011-01-11T09:54:20.057

Reputation: 283 655