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


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.


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.

| improve this answer | |
  • Negatory on both. error_log: client denied by server configuration – Dave Jun 11 '10 at 1: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 4:40

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

| improve this answer | |
  • -wget -d --user=foo --password=bar%21 url Still 403's – Dave Jun 11 '10 at 0:42

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


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.

| improve this answer | |
  • Tried that with and without escaping the !. Neither worked. – Dave Jun 11 '10 at 1:52
  • @Dave: See my edit. – Paused until further notice. Jun 11 '10 at 2:15

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 '!'

| improve this answer | |
  • 1
    those are identical? – SimonJGreen May 17 '13 at 8:38
  • It was an error in markup that made them look similar; it's fixed now. @user174154: use the "code" markup for things like this, i.e. the curly braces. – Jenny D May 17 '13 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.