Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a bash script called and it current is:

lynx -dump $url > story.txt
echo "step one completed"

Except when I run ./ or any website, story.txt says:

   You don't have permission to access / on this server.

How do I fix it so that when I open story.txt, it displays the actual dump of the url?

share|improve this question
this would probably be better asked on stackoverflow. – ImaginaryRobots Dec 6 '12 at 20:19
This won't work because $url has no value. Try setting it and seeing what you get. – Scott Severance Dec 7 '12 at 3:37
up vote 4 down vote accepted

Your script does not work for me, but I guess it does for you so we might have a different setup. I changed the script to

lynx -dump $1 > story.txt
echo "step one completed"

I run it with


and I get the same result.

Instead of running the script with try with and you will see that the script actually works just fine. The problem is not with your script but with the website you are trying to access. I believe it blocks website crawlers, because lynx is a command line browser it actually acts exactly like a crawler, resulting in the message you get.

You can set different rules for websites, if a website blocks unknown crawlers then it will also probably block lynx (or any other command line browser). Your script is fine, the website is blocking you.

share|improve this answer
This worked!!!! Thank you so much! My script wasn't working which is why I asked in the first place! – helloworld Dec 6 '12 at 20:46

That URL gives an error with curl too:

curl -i
HTTP/1.1 403 Forbidden
Server: AkamaiGHost
Mime-Version: 1.0
Content-Type: text/html
Content-Length: 260
Cache-Control: max-age=3600
Date: Thu, 06 Dec 2012 20:17:17 GMT
Connection: close

<TITLE>Access Denied</TITLE>
<H1>Access Denied</H1>

You don't have permission to access "http&#58;&#47;&#47;www&#46;fox&#46;com&#47;" on this server.<P>

Apparently the site is doing some weird user agent sniffing. Passing a Firefox user agent seems to work:

curl -i -A 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:17.0) Gecko/17.0 Firefox/17.0'
HTTP/1.1 200 OK
Server: Apache
Content-Length: 70647
Content-Type: text/html; charset=utf-8
Cache-Control: max-age=3600
Date: Thu, 06 Dec 2012 20:22:58 GMT
Connection: keep-alive

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" xmlns:tp="" xmlns:og="" xmlns:fb="" >
        <title>FOX Broadcasting Company - FOX Television Shows</title>
share|improve this answer
It's Fox after all - they fear what they don't understand (wget in this case), so they ban it. Sorry, could not resist. – Marcin Kaminski Dec 6 '12 at 20:34
That works fine on it's own. But when I run in terminal, ./ it doesn't work where is now: url=<br> curl -i -A 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:17.0) Gecko/17.0 Firefox/17.0' $url > story.txt<br> echo "step one completed" – helloworld Dec 6 '12 at 20:36
This did not work with the but thank you nevertheless! – helloworld Dec 6 '12 at 20:56
You have to set $url to something. Instead of url=, try something like url="". – Scott Severance Dec 7 '12 at 3:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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