File permissions are not communicated in the process of an HTTP file transfer. All nginx
does is open the binary file, read the data, and stream it to the client (wget
). Setting permissions on the client machine is determined by the umask
on the client, and whatever else your web client browser might do to it.
If you're looking to simplify the steps to download and execute the binary, there are a few approaches you could take. One would simply be:
wget -O binary http://example.com/binary && chmod +x ./binary && ./binary
Or, you could place a shell script at http://example.com/install.sh
:
#!/bin/sh
if wget -O "binary" "http://example.com/binary"; then
chmod +x "./binary"
echo "Successfully installed binary. To run, use: ./binary"
# Or just run it here:
# ./binary
else
echo "Failed to download binary." >&2
fi
Then, your installation can be:
wget -O - http://example.com/install.sh | sh
Or:
curl -o - http://example.com/install.sh | sh
Note that none of these methods of installation are secure, at all. You need to calculate signatures for the binary (and the shell script) and verify them at download time, and I recommend using HTTPS. But, I'm assuming this is for some type of internal use (in which case, security is still usually important)!