23

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.

32

I use (in a Windows domain environment):

curl --ntlm -u : ...

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

1
  • 3
    Thanks @BillP3rd! Just a heads up: this works perfectly when running curl within a Windows command prompt, but does not work if you are running within a terminal emulator like Cygwin on your Windows machine. – ErinsMatthew Mar 12 '16 at 12:20
12

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 ...

2

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
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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