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.

4 Answers 4

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.

3
  • Negatory on both. error_log: client denied by server configuration
    – Dave
    Jun 11, 2010 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, 2010 at 4:40
  • I prefer ' as it escapes other special characters such as $ Oct 21, 2022 at 3:53
0

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

1
  • -wget -d --user=foo --password=bar%21 url Still 403's
    – Dave
    Jun 11, 2010 at 0:42
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.

2
  • Tried that with and without escaping the !. Neither worked.
    – Dave
    Jun 11, 2010 at 1:52
  • @Dave: See my edit. Jun 11, 2010 at 2:15
0

Don't work:

wget ftp://user:[email protected]/file

You can use:

wget ftp://user:p\[email protected]/file

Please note the '\' before '!'

2
  • 1
    those are identical? May 17, 2013 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, 2013 at 9:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .