How to supply user and password to download USGS data with wget?

I think that http://e4ftl01.cr.usgs.gov/ has recently applied a login and pass authentication to retrieve data. my script was working before, but now it comes with an error HTTP request sent, awaiting response... 401 Unauthorized

Username/Password Authentication Failed.

I have login and pass, so how and where do I put it in the script? cheers

#!/bin/sh    for YEAR in  2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 ;   do      wget -r -l1 -p -nd -e robots=off -A "*h17v03*","*h18v03*" -R .jpg -R .xml http://e4ftl01.cr.usgs.gov/MOLA/MYD13Q1.005/$YEAR.07.03  wget -r -l1 -p -nd -e robots=off -A "*h17v03*","*h18v03*" -R .jpg -R .xml http://e4ftl01.cr.usgs.gov/MOLA/MYD13Q1.005/$YEAR.07.04 done    #!/bin/sh 

Replay

Indeed the LP DAAC access requires authentication (as of 20 July 2016). You need to use your "Earthdata" login (not USGS login, if you've previously been coming in from there).

You also need to authorise that Earthdata login on the Earthdata profile page.

USGS provided some command line tips, of which the following is in the wget specific section:

wget -L --load-cookies ~/.cookies --save-cookies ~/.cookies http://e4ftl01.cr.usgs.gov/MOLT/MOD09A1.006/2001.01.09/MOD09A1.A2001009.h13v01.006.2015140120258.hdf

The reason why the --username and --password options don't appear is that best practice is to use a .netrc file, which looks like:

machine urs.earthdata.nasa.gov
        login username
        password userpassword

(or whichever other machines in the data pool you are using).

Category: modis Time: 2016-07-30 Views: 0
Tags: shell modis

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 3.625 (s). 13 q(s)