How can I pass my Windows credentials in cURL?

I'm writing a script that uses cURL to pull data from an internal web server. I can explicitly use --user combined with --ntlm and everything works well, but I can't get it to recognize whomever's logged in and pass it transparently. If I visit the same site in Chrome/Firefox/IE it immediately gives me permissions without any prompts (We are using a proxy here if that's important). The server is using IIS.


Solution 1:

I use (in a Windows domain environment):

curl --ntlm -u : ...

cUrl knows to supply my domain credentials and it works every time.

Solution 2:

Use -u : which provides an empty usercode and password, to get cURL to pick those up from the credential store.

I use this on Unix with GSSAPI and curl -u : --negotiate ...

Solution 3:

To elaborate on @Phil P answer heres how I did it from my ubuntu box.

  1. Find out the IP address of your domain controller instructions on how to do that here
  2. Install kerberos sudo apt-get install krb5-user
  3. Enter the following in your /etc/krb5.conf

    [libdefaults]
        default_realm = YOURDOMAN
        # note that this must be in UPPER CASE
        krb4_config = /etc/krb.conf
        krb4_realms = /etc/krb.realms
        kdc_timesync = 1
        ccache_type = 4
        forwardable = true
        proxiable = true
        v4_instance_resolve = false
        v4_name_convert = {
            host = {
                rcmd = host
                ftp = ftp
            }
            plain = {
                something = something-else
            }
        }
        fcc-mit-ticketflags = true
    [realms]
        YOURDOMAN = {
            kdc = YOUR_DOAMIN_CONTROLLER_IP
        }
    [domain_realm]
        yourdomain = yourdomain
        yourdomain. = yourdomain