Validating rsync via SSH authorized_keys command=“…”Restrict rsync over ssh read only / only copy from remote hostRestricting a ssh key to only allow rsync/file transfer?Is it possible to use rsync over sftp (without an ssh shell)?sshd_config ForceCommand /usr/bin/rsync error “connection unexpectedly closed”DeltaCopy (Rsync for windows) giving an error on task runrsync connection closing right around an hourwhy rsync is not working with crontab?SVN Post Commit Issue (Calling Bash)Rsync with ssh and root not working after change hosts IPRsnapshot frequently exits with error 12 when processing tar.gz filessh connects okay from command line but from cron using publickeyCygwin Windows < Linux rsync - connection unexpectedly closed

Can an isometry leave entropy invariant?

Pressure inside an infinite ocean?

What is the difference between 'unconcealed' and 'revealed'?

I need a disease

How can I close a gap between my fence and my neighbor's that's on his side of the property line?

If your medical expenses exceed your income does the IRS pay you?

Position of past participle and extent of the Verbklammer

Can you complete the sequence?

Is there an idiom that support the idea that "inflation is bad"?

BOOM! Perfect Clear for Mr. T

How wide is a neg symbol, how to get the width for alignment?

How might a mountain bowl form?

I have a unique character that I'm having a problem writing. He's a virus!

As matter approaches a black hole, does it speed up?

Have I damaged my car by attempting to reverse with hand/park brake up?

what to look for in luxury cars like Acura/Lexus

Would Hubble Space Telescope improve black hole image observed by EHT if it joined array of telesopes?

Verb "geeitet" in an old scientific text

In Avengers 1, why does Thanos need Loki?

Why was the battle set up *outside* Winterfell?

Which module had more 'comfort' in terms of living space, the Lunar Module or the Command module?

Do Maps have an Reliable Relationship between keySet() order and values() order?

Building a list of products from the elements in another list

how to overfit?



Validating rsync via SSH authorized_keys command=“…”


Restrict rsync over ssh read only / only copy from remote hostRestricting a ssh key to only allow rsync/file transfer?Is it possible to use rsync over sftp (without an ssh shell)?sshd_config ForceCommand /usr/bin/rsync error “connection unexpectedly closed”DeltaCopy (Rsync for windows) giving an error on task runrsync connection closing right around an hourwhy rsync is not working with crontab?SVN Post Commit Issue (Calling Bash)Rsync with ssh and root not working after change hosts IPRsnapshot frequently exits with error 12 when processing tar.gz filessh connects okay from command line but from cron using publickeyCygwin Windows < Linux rsync - connection unexpectedly closed






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I'm trying to validate rsync via sshd's authorized_keys file.



The problem is I can't manage to execute rsync from the validating script.




Here's my authorized_keys file:



command="/home/username/Desktop/valrsync username" ssh-rsa AAAA [...]



Here's the valrsync script attempted differently each time:



Test 1 -



$SSH_ORIGINAL_COMMAND


Output -



$ rsync [...] / username@remotemachine:/
/home/username/Desktop/valrsync: line 2: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]


And, more importantly, Test 2 -



#!/usr/bin/python

import os
os.system(os.getenv('SSH_ORIGINAL_COMMAND'))


Output (running rsync from the local machine and getting the output of valrsync on the remote machine) -



$ rsync [...] / username@remotemachine:/
sh: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]



I understand that rsync somehow spawns an instance of itself at the remote machine, and obviously that instance is not referred when I attempt to execute the rsync command via the script. rsync is not installed on the server, and I know it shouldn't be.



Now the question is, what can I do about it (except maybe installing rsync on the server...?)










share|improve this question




























    1















    I'm trying to validate rsync via sshd's authorized_keys file.



    The problem is I can't manage to execute rsync from the validating script.




    Here's my authorized_keys file:



    command="/home/username/Desktop/valrsync username" ssh-rsa AAAA [...]



    Here's the valrsync script attempted differently each time:



    Test 1 -



    $SSH_ORIGINAL_COMMAND


    Output -



    $ rsync [...] / username@remotemachine:/
    /home/username/Desktop/valrsync: line 2: rsync: command not found
    rsync: connection unexpectedly closed (0 bytes received so far) [sender]
    rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]


    And, more importantly, Test 2 -



    #!/usr/bin/python

    import os
    os.system(os.getenv('SSH_ORIGINAL_COMMAND'))


    Output (running rsync from the local machine and getting the output of valrsync on the remote machine) -



    $ rsync [...] / username@remotemachine:/
    sh: rsync: command not found
    rsync: connection unexpectedly closed (0 bytes received so far) [sender]
    rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]



    I understand that rsync somehow spawns an instance of itself at the remote machine, and obviously that instance is not referred when I attempt to execute the rsync command via the script. rsync is not installed on the server, and I know it shouldn't be.



    Now the question is, what can I do about it (except maybe installing rsync on the server...?)










    share|improve this question
























      1












      1








      1


      1






      I'm trying to validate rsync via sshd's authorized_keys file.



      The problem is I can't manage to execute rsync from the validating script.




      Here's my authorized_keys file:



      command="/home/username/Desktop/valrsync username" ssh-rsa AAAA [...]



      Here's the valrsync script attempted differently each time:



      Test 1 -



      $SSH_ORIGINAL_COMMAND


      Output -



      $ rsync [...] / username@remotemachine:/
      /home/username/Desktop/valrsync: line 2: rsync: command not found
      rsync: connection unexpectedly closed (0 bytes received so far) [sender]
      rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]


      And, more importantly, Test 2 -



      #!/usr/bin/python

      import os
      os.system(os.getenv('SSH_ORIGINAL_COMMAND'))


      Output (running rsync from the local machine and getting the output of valrsync on the remote machine) -



      $ rsync [...] / username@remotemachine:/
      sh: rsync: command not found
      rsync: connection unexpectedly closed (0 bytes received so far) [sender]
      rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]



      I understand that rsync somehow spawns an instance of itself at the remote machine, and obviously that instance is not referred when I attempt to execute the rsync command via the script. rsync is not installed on the server, and I know it shouldn't be.



      Now the question is, what can I do about it (except maybe installing rsync on the server...?)










      share|improve this question














      I'm trying to validate rsync via sshd's authorized_keys file.



      The problem is I can't manage to execute rsync from the validating script.




      Here's my authorized_keys file:



      command="/home/username/Desktop/valrsync username" ssh-rsa AAAA [...]



      Here's the valrsync script attempted differently each time:



      Test 1 -



      $SSH_ORIGINAL_COMMAND


      Output -



      $ rsync [...] / username@remotemachine:/
      /home/username/Desktop/valrsync: line 2: rsync: command not found
      rsync: connection unexpectedly closed (0 bytes received so far) [sender]
      rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]


      And, more importantly, Test 2 -



      #!/usr/bin/python

      import os
      os.system(os.getenv('SSH_ORIGINAL_COMMAND'))


      Output (running rsync from the local machine and getting the output of valrsync on the remote machine) -



      $ rsync [...] / username@remotemachine:/
      sh: rsync: command not found
      rsync: connection unexpectedly closed (0 bytes received so far) [sender]
      rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]



      I understand that rsync somehow spawns an instance of itself at the remote machine, and obviously that instance is not referred when I attempt to execute the rsync command via the script. rsync is not installed on the server, and I know it shouldn't be.



      Now the question is, what can I do about it (except maybe installing rsync on the server...?)







      ssh rsync






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jul 7 '11 at 18:54









      MarkMark

      62




      62




















          3 Answers
          3






          active

          oldest

          votes


















          5














          The error you're receiving is rsync: command not found. This typically implies that your $PATH environment variable is not set correctly. Using your first test, explicitly set PATH to include the directory where the rsync command is installed. For example:



          #!/bin/sh

          PATH=/usr/local/bin:$PATH
          export PATH

          $SSH_ORIGINAL_COMMAND


          Make sure to make the scrip executable (chmod 755 valrsync).



          All this assumes that rsync is in fact installed on the target system.






          share|improve this answer























          • Thank you for your replay. Is the only way to solve this is to install rsync on the target machine?

            – Mark
            Jul 7 '11 at 20:20







          • 2





            Yes, you need to have rsync installed on both the source and destination machine. Rsync needs to run on both ends of the connection (because otherwise, what is rsync talking to?).

            – larsks
            Jul 7 '11 at 20:45


















          2














          A better method than writing a homebrew script would be to use rrsync, which on Debian-based distros you should already have installed alongside rsync in /usr/share/doc/rsync/scripts/rrsync.gz. In that case simply run the following command to unpack the gzipped script into /usr/bin/rrsync:



          gunzip /usr/share/doc/rsync/scripts/rrsync.gz -c|sudo tee^Cusr/bin/rrsync && sudo chmod +x /usr/bin/rrsync


          (when already running as root you can obviously leave off the sudo invocations)



          Alternatively download rrsync here.



          Reminder: having rsync installed on the remote machine (the one with the authorized_keys file) is a prerequisite here.



          Once that's done you can simply prepend a command= in front of a line with a public key, invoking rrsync.



          Usually you would include some restrictive SSH options along with the command=, so it might look like this:



          command="/usr/bin/rrsync -wo /data/backup/",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ecdsa-sha2-nistp521 AAAAE...


          By giving that directory (you can use -ro for read-only and -wo for write-only) you can leave off the directory on the rsync invocation.



          So your command line would become rsync [...] / username@remotemachine: (mind the missing path after the :).






          share|improve this answer






























            0














            Ensure that you have rsync installed and in the PATH on both ends (client and server). The rsync client uses SSH to execute rsync on the remote (server) end. That's just how rsync works.






            share|improve this answer























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "2"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f288022%2fvalidating-rsync-via-ssh-authorized-keys-command%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              5














              The error you're receiving is rsync: command not found. This typically implies that your $PATH environment variable is not set correctly. Using your first test, explicitly set PATH to include the directory where the rsync command is installed. For example:



              #!/bin/sh

              PATH=/usr/local/bin:$PATH
              export PATH

              $SSH_ORIGINAL_COMMAND


              Make sure to make the scrip executable (chmod 755 valrsync).



              All this assumes that rsync is in fact installed on the target system.






              share|improve this answer























              • Thank you for your replay. Is the only way to solve this is to install rsync on the target machine?

                – Mark
                Jul 7 '11 at 20:20







              • 2





                Yes, you need to have rsync installed on both the source and destination machine. Rsync needs to run on both ends of the connection (because otherwise, what is rsync talking to?).

                – larsks
                Jul 7 '11 at 20:45















              5














              The error you're receiving is rsync: command not found. This typically implies that your $PATH environment variable is not set correctly. Using your first test, explicitly set PATH to include the directory where the rsync command is installed. For example:



              #!/bin/sh

              PATH=/usr/local/bin:$PATH
              export PATH

              $SSH_ORIGINAL_COMMAND


              Make sure to make the scrip executable (chmod 755 valrsync).



              All this assumes that rsync is in fact installed on the target system.






              share|improve this answer























              • Thank you for your replay. Is the only way to solve this is to install rsync on the target machine?

                – Mark
                Jul 7 '11 at 20:20







              • 2





                Yes, you need to have rsync installed on both the source and destination machine. Rsync needs to run on both ends of the connection (because otherwise, what is rsync talking to?).

                – larsks
                Jul 7 '11 at 20:45













              5












              5








              5







              The error you're receiving is rsync: command not found. This typically implies that your $PATH environment variable is not set correctly. Using your first test, explicitly set PATH to include the directory where the rsync command is installed. For example:



              #!/bin/sh

              PATH=/usr/local/bin:$PATH
              export PATH

              $SSH_ORIGINAL_COMMAND


              Make sure to make the scrip executable (chmod 755 valrsync).



              All this assumes that rsync is in fact installed on the target system.






              share|improve this answer













              The error you're receiving is rsync: command not found. This typically implies that your $PATH environment variable is not set correctly. Using your first test, explicitly set PATH to include the directory where the rsync command is installed. For example:



              #!/bin/sh

              PATH=/usr/local/bin:$PATH
              export PATH

              $SSH_ORIGINAL_COMMAND


              Make sure to make the scrip executable (chmod 755 valrsync).



              All this assumes that rsync is in fact installed on the target system.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jul 7 '11 at 19:19









              larskslarsks

              35.1k593145




              35.1k593145












              • Thank you for your replay. Is the only way to solve this is to install rsync on the target machine?

                – Mark
                Jul 7 '11 at 20:20







              • 2





                Yes, you need to have rsync installed on both the source and destination machine. Rsync needs to run on both ends of the connection (because otherwise, what is rsync talking to?).

                – larsks
                Jul 7 '11 at 20:45

















              • Thank you for your replay. Is the only way to solve this is to install rsync on the target machine?

                – Mark
                Jul 7 '11 at 20:20







              • 2





                Yes, you need to have rsync installed on both the source and destination machine. Rsync needs to run on both ends of the connection (because otherwise, what is rsync talking to?).

                – larsks
                Jul 7 '11 at 20:45
















              Thank you for your replay. Is the only way to solve this is to install rsync on the target machine?

              – Mark
              Jul 7 '11 at 20:20






              Thank you for your replay. Is the only way to solve this is to install rsync on the target machine?

              – Mark
              Jul 7 '11 at 20:20





              2




              2





              Yes, you need to have rsync installed on both the source and destination machine. Rsync needs to run on both ends of the connection (because otherwise, what is rsync talking to?).

              – larsks
              Jul 7 '11 at 20:45





              Yes, you need to have rsync installed on both the source and destination machine. Rsync needs to run on both ends of the connection (because otherwise, what is rsync talking to?).

              – larsks
              Jul 7 '11 at 20:45













              2














              A better method than writing a homebrew script would be to use rrsync, which on Debian-based distros you should already have installed alongside rsync in /usr/share/doc/rsync/scripts/rrsync.gz. In that case simply run the following command to unpack the gzipped script into /usr/bin/rrsync:



              gunzip /usr/share/doc/rsync/scripts/rrsync.gz -c|sudo tee^Cusr/bin/rrsync && sudo chmod +x /usr/bin/rrsync


              (when already running as root you can obviously leave off the sudo invocations)



              Alternatively download rrsync here.



              Reminder: having rsync installed on the remote machine (the one with the authorized_keys file) is a prerequisite here.



              Once that's done you can simply prepend a command= in front of a line with a public key, invoking rrsync.



              Usually you would include some restrictive SSH options along with the command=, so it might look like this:



              command="/usr/bin/rrsync -wo /data/backup/",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ecdsa-sha2-nistp521 AAAAE...


              By giving that directory (you can use -ro for read-only and -wo for write-only) you can leave off the directory on the rsync invocation.



              So your command line would become rsync [...] / username@remotemachine: (mind the missing path after the :).






              share|improve this answer



























                2














                A better method than writing a homebrew script would be to use rrsync, which on Debian-based distros you should already have installed alongside rsync in /usr/share/doc/rsync/scripts/rrsync.gz. In that case simply run the following command to unpack the gzipped script into /usr/bin/rrsync:



                gunzip /usr/share/doc/rsync/scripts/rrsync.gz -c|sudo tee^Cusr/bin/rrsync && sudo chmod +x /usr/bin/rrsync


                (when already running as root you can obviously leave off the sudo invocations)



                Alternatively download rrsync here.



                Reminder: having rsync installed on the remote machine (the one with the authorized_keys file) is a prerequisite here.



                Once that's done you can simply prepend a command= in front of a line with a public key, invoking rrsync.



                Usually you would include some restrictive SSH options along with the command=, so it might look like this:



                command="/usr/bin/rrsync -wo /data/backup/",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ecdsa-sha2-nistp521 AAAAE...


                By giving that directory (you can use -ro for read-only and -wo for write-only) you can leave off the directory on the rsync invocation.



                So your command line would become rsync [...] / username@remotemachine: (mind the missing path after the :).






                share|improve this answer

























                  2












                  2








                  2







                  A better method than writing a homebrew script would be to use rrsync, which on Debian-based distros you should already have installed alongside rsync in /usr/share/doc/rsync/scripts/rrsync.gz. In that case simply run the following command to unpack the gzipped script into /usr/bin/rrsync:



                  gunzip /usr/share/doc/rsync/scripts/rrsync.gz -c|sudo tee^Cusr/bin/rrsync && sudo chmod +x /usr/bin/rrsync


                  (when already running as root you can obviously leave off the sudo invocations)



                  Alternatively download rrsync here.



                  Reminder: having rsync installed on the remote machine (the one with the authorized_keys file) is a prerequisite here.



                  Once that's done you can simply prepend a command= in front of a line with a public key, invoking rrsync.



                  Usually you would include some restrictive SSH options along with the command=, so it might look like this:



                  command="/usr/bin/rrsync -wo /data/backup/",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ecdsa-sha2-nistp521 AAAAE...


                  By giving that directory (you can use -ro for read-only and -wo for write-only) you can leave off the directory on the rsync invocation.



                  So your command line would become rsync [...] / username@remotemachine: (mind the missing path after the :).






                  share|improve this answer













                  A better method than writing a homebrew script would be to use rrsync, which on Debian-based distros you should already have installed alongside rsync in /usr/share/doc/rsync/scripts/rrsync.gz. In that case simply run the following command to unpack the gzipped script into /usr/bin/rrsync:



                  gunzip /usr/share/doc/rsync/scripts/rrsync.gz -c|sudo tee^Cusr/bin/rrsync && sudo chmod +x /usr/bin/rrsync


                  (when already running as root you can obviously leave off the sudo invocations)



                  Alternatively download rrsync here.



                  Reminder: having rsync installed on the remote machine (the one with the authorized_keys file) is a prerequisite here.



                  Once that's done you can simply prepend a command= in front of a line with a public key, invoking rrsync.



                  Usually you would include some restrictive SSH options along with the command=, so it might look like this:



                  command="/usr/bin/rrsync -wo /data/backup/",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ecdsa-sha2-nistp521 AAAAE...


                  By giving that directory (you can use -ro for read-only and -wo for write-only) you can leave off the directory on the rsync invocation.



                  So your command line would become rsync [...] / username@remotemachine: (mind the missing path after the :).







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 8 '18 at 21:22









                  0xC0000022L0xC0000022L

                  95921536




                  95921536





















                      0














                      Ensure that you have rsync installed and in the PATH on both ends (client and server). The rsync client uses SSH to execute rsync on the remote (server) end. That's just how rsync works.






                      share|improve this answer



























                        0














                        Ensure that you have rsync installed and in the PATH on both ends (client and server). The rsync client uses SSH to execute rsync on the remote (server) end. That's just how rsync works.






                        share|improve this answer

























                          0












                          0








                          0







                          Ensure that you have rsync installed and in the PATH on both ends (client and server). The rsync client uses SSH to execute rsync on the remote (server) end. That's just how rsync works.






                          share|improve this answer













                          Ensure that you have rsync installed and in the PATH on both ends (client and server). The rsync client uses SSH to execute rsync on the remote (server) end. That's just how rsync works.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Feb 14 '14 at 18:21









                          RoubenRouben

                          894710




                          894710



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Server Fault!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f288022%2fvalidating-rsync-via-ssh-authorized-keys-command%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

                              What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

                              Why did Thanos need his ship to help him in the battle scene?Which actor plays Thanos in the Avengers mid-credits scene?Are there economic implications portrayed in comics where the buildings and cities are ruined almost daily?Old X-Men comic where team travels to alien world with a ring-like sun that needs recharging?Why does Ego need help sleeping?Is there an objective answer to who “the strongest Avenger” is?How did Banner get unstuck?Why did Thanos get hit?How did Thanos (or anyone) know the Infinity Stones would give him this power?Did Thanos leave Eitri alive for his after-sales service?In Avengers 1, why does Thanos need Loki?