wget for ftp using a password containing @

15

1

I am trying to get some files from my ftp server from the command line. I am using wget to download the whole folder at once. The command is:

wget -m ftp://username:password@ftp.hostname.com:/path/to/folder

But the problem is, my password contains the '@' symbol. Hence The command becomes

wget -m ftp://username:foo@bar@ftp.hostname.com:/.. 

due to which, wget tries to resove bar@ftp.hostname.com as the host, which it is not able to. Please help!

roopunk

Posted 2012-12-22T04:13:58.547

Reputation: 293

Answers

30

Rather than the user:pass@hostname syntax, use switches. From wget --help:

--ftp-user=USER         set ftp user to USER.
--ftp-password=PASS     set ftp password to PASS.

Example:

wget -m --ftp-user=username --ftp-password=foo@bar ftp://ftp.hostname.com/file

Dennis

Posted 2012-12-22T04:13:58.547

Reputation: 42 934

7

You can also URL encode the username and/or password. The @ symbol becomes %40

For example:

wget -m ftp://username:foo@bar@ftp.hostname.com:/.. 

can be written as

wget -m ftp://username:foo%40bar@ftp.hostname.com:/.. 

I realize this question has been solved long ago, but I saw this in the corner of my eye and thought I'd throw in a solution (this is actually useful, because it should work with anything that uses or supports using URIs, such as FileZilla or a web browser.)

John Chadwick

Posted 2012-12-22T04:13:58.547

Reputation: 562

-2

wget -m --ftp-user=username --ftp-password=foo@bar ftp://ftp.hostname.com/file -O /path_to_file/dest_file_name

Yezzo

Posted 2012-12-22T04:13:58.547

Reputation: 1

2Duplicates an answer given 3 years ago... – xenoid – 2017-07-12T06:38:11.403