Is it possible to set that path of the scp command to use by OpenSSH sshd daemon?





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







2















I have a curious problem with OpenSSH in SLES 12 SP4 Linux servers.



We install a customized OpenSSH on ourservers, so in each machine we have two versions of OpenSSH, the official package of the operating system and the one that we have compiled.



For the case of SLES 12 SP4 if we run the following command from another server



scp -r directory/. destination_server:/path/to/directory



the following error arises



scp: error: unexpected filename: .



We have verified that the problem is with the scp binary under /usr/bin/scp, which is run by our OpenSSH instead of its scp under its own path.



After searching and testing the solution applied is to remove the execution rights on /usr/bin/scp, so our version of OpenSSH can not use it, and the scp -r from the client works perfectly.



Is there a more elegant to way to tell to the daemon to use the scp binary under its own path instead of /usr/bin/scp?



Best regards










share|improve this question





























    2















    I have a curious problem with OpenSSH in SLES 12 SP4 Linux servers.



    We install a customized OpenSSH on ourservers, so in each machine we have two versions of OpenSSH, the official package of the operating system and the one that we have compiled.



    For the case of SLES 12 SP4 if we run the following command from another server



    scp -r directory/. destination_server:/path/to/directory



    the following error arises



    scp: error: unexpected filename: .



    We have verified that the problem is with the scp binary under /usr/bin/scp, which is run by our OpenSSH instead of its scp under its own path.



    After searching and testing the solution applied is to remove the execution rights on /usr/bin/scp, so our version of OpenSSH can not use it, and the scp -r from the client works perfectly.



    Is there a more elegant to way to tell to the daemon to use the scp binary under its own path instead of /usr/bin/scp?



    Best regards










    share|improve this question

























      2












      2








      2








      I have a curious problem with OpenSSH in SLES 12 SP4 Linux servers.



      We install a customized OpenSSH on ourservers, so in each machine we have two versions of OpenSSH, the official package of the operating system and the one that we have compiled.



      For the case of SLES 12 SP4 if we run the following command from another server



      scp -r directory/. destination_server:/path/to/directory



      the following error arises



      scp: error: unexpected filename: .



      We have verified that the problem is with the scp binary under /usr/bin/scp, which is run by our OpenSSH instead of its scp under its own path.



      After searching and testing the solution applied is to remove the execution rights on /usr/bin/scp, so our version of OpenSSH can not use it, and the scp -r from the client works perfectly.



      Is there a more elegant to way to tell to the daemon to use the scp binary under its own path instead of /usr/bin/scp?



      Best regards










      share|improve this question














      I have a curious problem with OpenSSH in SLES 12 SP4 Linux servers.



      We install a customized OpenSSH on ourservers, so in each machine we have two versions of OpenSSH, the official package of the operating system and the one that we have compiled.



      For the case of SLES 12 SP4 if we run the following command from another server



      scp -r directory/. destination_server:/path/to/directory



      the following error arises



      scp: error: unexpected filename: .



      We have verified that the problem is with the scp binary under /usr/bin/scp, which is run by our OpenSSH instead of its scp under its own path.



      After searching and testing the solution applied is to remove the execution rights on /usr/bin/scp, so our version of OpenSSH can not use it, and the scp -r from the client works perfectly.



      Is there a more elegant to way to tell to the daemon to use the scp binary under its own path instead of /usr/bin/scp?



      Best regards







      linux ssh scp






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 5 hours ago









      CigesCiges

      1214




      1214






















          1 Answer
          1






          active

          oldest

          votes


















          4














          It isn't the SSH daemon which uses the scp program directly, so no, you can't reconfigure it to use another binary. You need to remove all but the "right" scp binaries from the system, or rewrite the PATH environmental variable (preferably in the system default profile), because from the viewpoint of the SSH daemon, scp is just a wrapper for running a remote command.



          Basically, here is what scp does:




          1. Initiates the connection through ssh

          2. Sends the scp -t (target path) command through the channel, as if you used the ssh user@target scp -t /this/file command.

          3. Sends the access mode and the file length, ending with 'n'.

          4. Sends the file contents through the SSH channel.


          You can emulate scp with the following commands:



          ssh user@host scp -t /tmp/aFile.to.create
          (enter your password)
          C0664 41 originalFileName
          The file should contain
          these two lines.
          (press enter twice)


          The third line contains the access rights, the file size, and the original file name. And since the scp command sent "as is", it is up to the target system to find that program for the user.






          share|improve this answer
























          • Thanks a lot. I have tested to modify in PATH to set the correct one as first (in /et/local.profile) but without luck. In the next meeting with the linux guys I will give your detailed answer, and maybe they know where to set it.

            – Ciges
            2 hours ago












          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%2f965259%2fis-it-possible-to-set-that-path-of-the-scp-command-to-use-by-openssh-sshd-daemon%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          It isn't the SSH daemon which uses the scp program directly, so no, you can't reconfigure it to use another binary. You need to remove all but the "right" scp binaries from the system, or rewrite the PATH environmental variable (preferably in the system default profile), because from the viewpoint of the SSH daemon, scp is just a wrapper for running a remote command.



          Basically, here is what scp does:




          1. Initiates the connection through ssh

          2. Sends the scp -t (target path) command through the channel, as if you used the ssh user@target scp -t /this/file command.

          3. Sends the access mode and the file length, ending with 'n'.

          4. Sends the file contents through the SSH channel.


          You can emulate scp with the following commands:



          ssh user@host scp -t /tmp/aFile.to.create
          (enter your password)
          C0664 41 originalFileName
          The file should contain
          these two lines.
          (press enter twice)


          The third line contains the access rights, the file size, and the original file name. And since the scp command sent "as is", it is up to the target system to find that program for the user.






          share|improve this answer
























          • Thanks a lot. I have tested to modify in PATH to set the correct one as first (in /et/local.profile) but without luck. In the next meeting with the linux guys I will give your detailed answer, and maybe they know where to set it.

            – Ciges
            2 hours ago
















          4














          It isn't the SSH daemon which uses the scp program directly, so no, you can't reconfigure it to use another binary. You need to remove all but the "right" scp binaries from the system, or rewrite the PATH environmental variable (preferably in the system default profile), because from the viewpoint of the SSH daemon, scp is just a wrapper for running a remote command.



          Basically, here is what scp does:




          1. Initiates the connection through ssh

          2. Sends the scp -t (target path) command through the channel, as if you used the ssh user@target scp -t /this/file command.

          3. Sends the access mode and the file length, ending with 'n'.

          4. Sends the file contents through the SSH channel.


          You can emulate scp with the following commands:



          ssh user@host scp -t /tmp/aFile.to.create
          (enter your password)
          C0664 41 originalFileName
          The file should contain
          these two lines.
          (press enter twice)


          The third line contains the access rights, the file size, and the original file name. And since the scp command sent "as is", it is up to the target system to find that program for the user.






          share|improve this answer
























          • Thanks a lot. I have tested to modify in PATH to set the correct one as first (in /et/local.profile) but without luck. In the next meeting with the linux guys I will give your detailed answer, and maybe they know where to set it.

            – Ciges
            2 hours ago














          4












          4








          4







          It isn't the SSH daemon which uses the scp program directly, so no, you can't reconfigure it to use another binary. You need to remove all but the "right" scp binaries from the system, or rewrite the PATH environmental variable (preferably in the system default profile), because from the viewpoint of the SSH daemon, scp is just a wrapper for running a remote command.



          Basically, here is what scp does:




          1. Initiates the connection through ssh

          2. Sends the scp -t (target path) command through the channel, as if you used the ssh user@target scp -t /this/file command.

          3. Sends the access mode and the file length, ending with 'n'.

          4. Sends the file contents through the SSH channel.


          You can emulate scp with the following commands:



          ssh user@host scp -t /tmp/aFile.to.create
          (enter your password)
          C0664 41 originalFileName
          The file should contain
          these two lines.
          (press enter twice)


          The third line contains the access rights, the file size, and the original file name. And since the scp command sent "as is", it is up to the target system to find that program for the user.






          share|improve this answer













          It isn't the SSH daemon which uses the scp program directly, so no, you can't reconfigure it to use another binary. You need to remove all but the "right" scp binaries from the system, or rewrite the PATH environmental variable (preferably in the system default profile), because from the viewpoint of the SSH daemon, scp is just a wrapper for running a remote command.



          Basically, here is what scp does:




          1. Initiates the connection through ssh

          2. Sends the scp -t (target path) command through the channel, as if you used the ssh user@target scp -t /this/file command.

          3. Sends the access mode and the file length, ending with 'n'.

          4. Sends the file contents through the SSH channel.


          You can emulate scp with the following commands:



          ssh user@host scp -t /tmp/aFile.to.create
          (enter your password)
          C0664 41 originalFileName
          The file should contain
          these two lines.
          (press enter twice)


          The third line contains the access rights, the file size, and the original file name. And since the scp command sent "as is", it is up to the target system to find that program for the user.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 3 hours ago









          LacekLacek

          2,2181116




          2,2181116













          • Thanks a lot. I have tested to modify in PATH to set the correct one as first (in /et/local.profile) but without luck. In the next meeting with the linux guys I will give your detailed answer, and maybe they know where to set it.

            – Ciges
            2 hours ago



















          • Thanks a lot. I have tested to modify in PATH to set the correct one as first (in /et/local.profile) but without luck. In the next meeting with the linux guys I will give your detailed answer, and maybe they know where to set it.

            – Ciges
            2 hours ago

















          Thanks a lot. I have tested to modify in PATH to set the correct one as first (in /et/local.profile) but without luck. In the next meeting with the linux guys I will give your detailed answer, and maybe they know where to set it.

          – Ciges
          2 hours ago





          Thanks a lot. I have tested to modify in PATH to set the correct one as first (in /et/local.profile) but without luck. In the next meeting with the linux guys I will give your detailed answer, and maybe they know where to set it.

          – Ciges
          2 hours ago


















          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%2f965259%2fis-it-possible-to-set-that-path-of-the-scp-command-to-use-by-openssh-sshd-daemon%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

          GameSpot

          日野市

          Tu-95轟炸機