You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

When using cURL or Wget to access data over HTTP from a web server configured for Earthdata Login authentication.

Step-by-step guide

  1. Make sure you have authorized the application from which you are downloading data (see How To Pre-authorize an application). The application website should also have instructions on how to do this.

  2. Configure your username and password for authentication using a .netrc file

      > cd ~
      > touch .netrc
      > echo "machine urs.earthdata.nasa.gov login <uid> password <password>" > .netrc
      > chmod 0600 .netrc

    where <uid> is your Earthdata Login username and <password> is your Earthdata Login password. DO NOT put the < > characters surrounding uid and password in the string, they are placeholder notation. Note that some password characters can cause problems. A backslash or space anywhere in your password will need to be escaped with an additional backslash. Similarly, if you use a '#' as the first character of your password, it will also need to be escaped with a preceding backslash.

    If your uid is some_user and your password is ABCdef123! this line should look like:
    > echo "machine urs.earthdata.nasa.gov login some_user password ABCdef123!" > .netrc

  3. Create a cookie file. This will be used to persist sessions across individual cURL/Wget calls, making it more efficient.

      > cd ~
      > touch .urs_cookies

  4. Download your data.

    Using cURL:

      > curl -b ~/.urs_cookies -c ~/.urs_cookies -L -n http://server/path

    or Wget:

      > wget --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --keep-session-cookies http://server/path

    Note that you may supply additional options to control the output location.

  • No labels