6

I'm trying to execute something like this:

wget --user=foo --password=bar! url

The ! in the password is causing problems. I've tried escaping it with \, as in

--password=bar\!

I've tried encapsulating in single and double quotes. I put the password in a separate file and tried

--password=cat pass.txt

Each time, I get a 403 Forbidden. Using -d, I see that the SSL handshake is successful. On the Windows command line, the command works. My assumption is that I need to escape the ! differently, but I don't know how else.

Dave
  • 133
  • 1
  • 1
  • 5

4 Answers4

8

Try using quotes:

--password="bar\!" or --password='bar\!'

What is the error on the server side?

Update: I ran a test on my Ubuntu 10.4 machine running Apache 2.2.14. wget --user=foo --password=bar! url works for me.

If I use the wrong password, I get an error like user foo: authentication failure for "/directorytest/": Password Mismatch.

Update again: (Taking a step back)

You say this error is "client denied by server configuration". I browsed the Apache source, and this error message comes from mod_authz_host. This indicates that your problem is not with the password (Which is authentication) but your client host is not authorized to access this Apache resource. mod_authz_host deals with hostnames and IPs.

Above, you say "On the Windows command line, the command works." Are all of your tests coming from the same client system? Are you running 'wget' on this same Windows system? What happens if you try to access this same URL using IE or Firefox?

More discussion here and here.

Stefan Lasiewski
  • 23,667
  • 41
  • 132
  • 186
  • Negatory on both. error_log: `client denied by server configuration` – Dave Jun 11 '10 at 01:48
  • Looks like you're right Stefan. mod_authz_host is included, and the vhost conf has Deny All, then has specific allows. Odd that we have it set to deny access from self. – Dave Jun 11 '10 at 04:40
  • I prefer `'` as it escapes other special characters such as `$` – Nicolas Raoul Oct 21 '22 at 03:53
0

Try %21, which is the URL-encoded value of !.

Ignacio Vazquez-Abrams
  • 45,939
  • 6
  • 79
  • 84
0

Try set +H to turn off Bash's history expansion.

Edit:

Try setting password = STRING, http_password = STRING or ftp_password = STRING in your ~/.wgetrc file or a file pointed to by the WGETRC environment variable and omitting the --password option from the command line.

Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151
0

Don't work:

wget ftp://user:p!w@url.com/file

You can use:

wget ftp://user:p\!w@url.com/file

Please note the '\' before '!'