Using curl with NTLM auth to make a post is failing

前端 未结 2 725
有刺的猬
有刺的猬 2021-02-03 23:44

I can\'t seem to wrap my head around this. I\'m trying to script automating an upload of a csv but the curl is failing with a 401.

curl -v --ntlm -u username --u         


        
相关标签:
2条回答
  • 2021-02-04 00:09

    You try this

    If you have a page hosted in IIS and that work with NTLM then you should put:

    (for example at Sharepoint page)

    curl http://enterprisesharepoint -v --ntlm --negotiate -u USER123:PASSWORD123
    

    It's work fine for me and you can see the headers message

    --Edit--

    if you put negotiate, this give the local account and log in with the server, if a user name and password are incorrect, that's no matter because negotiate do automatic autentication with windows account for the user local loged. If you don't like this behavior, you should be put only ntlm for correct ntlm login.

    0 讨论(0)
  • 2021-02-04 00:11

    The following works

    curl -X POST -k -v --ntlm --negotiate -u usernamehere -F "csv=@pt_update.csv" -F "op=add" "https://google.com/csv_import"

    0 讨论(0)
提交回复
热议问题