I am new to SharePoint. I was trying to download and upload file using Perl script in a Linux machine but getting an "NTLM Authentication Error" while running the script.

I tried downloading the file using "wget" providing valid credentials through following command:

wget --user username --password passwd http://dest.sharepoint.com/Folder/file.txt

But got the error "401 Unauthorized". I am not able to identify the cause. The 401 error occurs when authentication is required and it is not provided whether it has failed or not. But in the above case username and password provided is correct, because I am able to browse to the file using GUI in the browser with the same credentials.

If any one has any idea about this please let me know.



I have also come across this issue. Added -k option to curl command such as:

curl -k --ntlm -u username:password -O http://dest.sharepoint.com/Folder/file.txt

This will do the job.


thy curl : curl --ntlm -u username:password -O http://dest.sharepoint.com/Folder/file.txt

  • not working 0 file downloaded – VED Nov 19 '14 at 6:15
  • works fine here. replace username with username@example.com format – Eric Nov 20 '14 at 7:29
  • @Eric I don't think this works. Check the contents of the file you downloaded is not an HTML error page, instead of the file you were expecting. – Nick Bull Jul 15 '16 at 11:18
  • @Nick i have a test again just now, it works here. i get the correct file from sharepoint 2010 document library, using curl from osx. – Eric Jul 21 '16 at 6:31

This depends on the configured authentication-method. I.e. your method of access needs to be the same.

wget IMHO supports basic, disgest and NTML authentication. SharePoint 2013 supports (out-of-the-box) windows (i.e. NTLM), forms-based, and SAML-based claims authentication..

If you're SharePoint WebApplication is configured to use windows authentication, wget NTLM should work. As should the curl --ntlm-command.

If you're SharePoint is configured for forms-based authentication, you'll need to fake a login, and pass a cookie in your download-request. Check this question for ideas on how to do this.

I have no idea, what you could do if the SharePoint is configured for SAML-based claims authentication.


Please use rclone

apt install rclone
Or download latest one from https://rclone.org/downloads

Add credentials

vim /root/.config/rclone/rclone.conf

type = webdav
url = https://sharepoint.com/sites/SiteName/Documents
vendor = sharepoint
user = 
pass = 

Download file from SharePoint.

rclone sync --progress --ignore-size sharepoint:SourceFolder/file.txt DestFolder

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.