linux - Shell script wget download from S3 - Forbidden error -


i trying download file amazon's s3 using shell script , command wget. file in cuestion has public permissions, , able download using standard browsers. far have in script:

wget --no-check-certificate -p /tmp/sodownloads  https://s3-eu-west-1.amazonaws.com/mybucket/myfolder/myfile.so cp /tmp/sodownloads/myfile.so /home/hadoop/lib/native 

the problem bit odd me. while able download file directly terminal (just typing wget command), error pops when try execute shell script contains same command line (script ran >sh myscript.sh).

--2014-06-26 07:33:57--  https://s3-eu-west-1.amazonaws.com/mybucket/myfolder/myfile.so%0d resolving s3-eu-west-1.amazonaws.com (s3-eu-west-1.amazonaws.com)... xx.xxx.xx.xx connecting s3-eu-west-1.amazonaws.com (s3-eu-west-1.amazonaws.com)|xx.xxx.xx.xx|:443... connected. warning: cannot verify s3-eu-west-1.amazonaws.com's certificate, issued     ‘/c=us/o=verisign, inc./ou=verisign trust network/ou=terms of use @ https://www.verisign.com/rpa (c)10/cn=verisign class 3 secure server ca - g3’: unable locally verify issuer's authority. http request sent, awaiting response... 403 forbidden 2014-06-26 07:33:57 error 403: forbidden. 

now, aware can begginer error side, not able detect mispelling or error of type. appreciate can provide me solve issue.

as note, notice running script in ec2 instance provided amazon's elastic mapreduce framework, if has issue.

i suspect editor used write script has left little "gift."

the command line isn't same. closely:

--2014-06-26 07:33:57-- ... myfolder/myfile.so%0d                                               ^^^ what's about? 

that's urlencoding ascii cr, decimal 13 hex 0x0d. have embedded carriage return character in script shouldn't there, , wget seeing last character in url, , sending s3.

using less utility view file, or editor vi, stray character might show ^m... or, if they're on file, open vi, should see @ bottom of screen:

"foo" [dos] 1l, 5c           ^^^^^ 

if see that, inside vi...

:set ff=unix[enter]  :x[enter] 

...will convert line endings, , save file in should usable format, if problem you're having.

if you're editing files on windows, you'll want use editor understands how save files newlines, not carriage returns.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -