Download files from a http authenticated directory using wget

I wanted to download something off a sub-domain using wget that I have password protected using .htaccess
so the following command was NOT working

wget http://secure.asim.pk/myfiles.tar 

Luckily, we can pass two arguments to the same command and tell wget what the username and password is

wget http://secure.asim.pk/myfiles.tar --http-user=myuser --http-password=mypass 

Works Great!!

If you are using Ubuntu 8.10, have not enabled root user and trying to download to a directory that has “nobody” or “root” as owner then try pre-pending it with sudo

sudo wget http://secure.asim.pk/myfiles.tar --http-user=myuser --http-password=mypass 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.