1
votes

I am trying to download the shell file with the wget tool. When I am trying to download the particular .sh file, the file named .sh is getting downloaded, but the content shown in the file is the HTML, not the actual file content. Hence it is downloading the HTML page provided as an input. The scenarios are as follows

wget command

wget --user=username --password=password https://some_url/Required_shell.sh -P /root/Desktop/


When I directly copy the URL used in wget in the browser, it downloads the file, but same case not happens with wget tool.

URL pasted in browser

https://some_url/Required_shell.sh

Output with wget tool

Required_shell.sh with HTML content, not the required shell file.

1

1 Answers

0
votes

Some websites can disallow you to download its page by identifying that the user agent is not a browser. So you can mask the user agent by using –user-agent options and show wget like a browser as shown below.

wget --user-agent="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12" https://URL/TO/DOWNLOAD