Announcement

Collapse
No announcement yet.

Linux command line syntax for sudo scp?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Linux command line syntax for sudo scp?

    Hi Folks, -unsure if this is the right place for this question but didn't see any Linux specific forums.

    I'm running a HomeSeer Zee S2 controller.
    For one of my plug-ins to work now, I need to add two certs to the device.
    I have downloaded them off the web to my Windows machine.
    And I was told I could copy them from the Zee command line to the device. (Can't SFTP them over due to no root-rights issue, from what I was told).
    I don't know Linux but from googling, I cobbled the following together.
    Unfortunately, the Zee Linux Command line feature doesn't return anything after my attempts.
    Can anyone validate/correct my Linux syntax below?

    sudo scp -v 192.168.15.xx:/entrust_l1k.cer /usr/share/ca-certificates

    So I'm trying to copy a file from my laptop to the Zee
    Is this right? Not sure how to point to a Windows file location in Linux terms.
    Any suggestions would be welcome and most appreciated.

  • #2
    Originally posted by Otto-mation View Post
    Hi Folks, -unsure if this is the right place for this question but didn't see any Linux specific forums.

    I'm running a HomeSeer Zee S2 controller.
    For one of my plug-ins to work now, I need to add two certs to the device.
    I have downloaded them off the web to my Windows machine.
    And I was told I could copy them from the Zee command line to the device. (Can't SFTP them over due to no root-rights issue, from what I was told).
    I don't know Linux but from googling, I cobbled the following together.
    Unfortunately, the Zee Linux Command line feature doesn't return anything after my attempts.
    Can anyone validate/correct my Linux syntax below?

    sudo scp -v 192.168.15.xx:/entrust_l1k.cer /usr/share/ca-certificates

    So I'm trying to copy a file from my laptop to the Zee
    Is this right? Not sure how to point to a Windows file location in Linux terms.
    Any suggestions would be welcome and most appreciated.
    This will not work. If you are running this command from your laptop, you are asking sudo to execute on your laptop rather than on your remote Zee.

    There are ways to make this work via ssh rather than scp, but needing to use sudo on the remote computer is the challenging part. While it technically can be done, you would need to configure sudo on the Zee not to prompt you for your password. Or set up an agent on the Zee where you per-authenticate. IMO, not worth the hassle.

    For example: (assuming your certificate file is plain text)
    cat entrust_l1k.cer | ssh zee 'sudo cat - > /usr/share/ca-certificates/entrust_l1k.cer'

    It's best to scp to your own directory on the Zee, then use sudo to copy the file to the final directory.

    Since you mention your laptop is windows, download pscp.exe from the same site as where you got putty.exe (assuming you are using putty). If you are using other windows ssh client, like mobaxterm, then you have many unix tools per-delivered. Alternatively, you can use a windows gui scp client line WinSCP to drag and drop.

    The following should work.
    for below scp = pscp and ssh = putty:
    scp "c:\users\xxx\downloads\entrust_l1k.cer" zee:entrust_l1k.cer
    ssh zee
    sudo cp entrust_l1k.cer /usr/share/ca-certificates/

    Comment


    • #3
      Hi Len, thanks for the details.

      I hopefully took a shortcut via your advice and managed to successfully SFTP the files from my Windows laptop to the Zee's /tmp folder. (since I didn't know what you meant by "my directory" and I had read that the tmp folder was openly shared.

      Then, from the Zee's Linux Tools Command Line, I attempted to run

      sudo cp /tmp/entrust_l1k.cer /usr/share/ca-certificates/

      Wouldn't that be all I need?

      The Zee windows displayed
      running command sudo cp /tmp/entrust_l1k.cer /usr/share/ca-certificates/

      And that was it.
      Using WinSCP, I could see that no file was copied.

      Am I close?

      Comment


      • #4
        Originally posted by Otto-mation View Post
        Hi Len, thanks for the details.

        I hopefully took a shortcut via your advice and managed to successfully SFTP the files from my Windows laptop to the Zee's /tmp folder. (since I didn't know what you meant by "my directory" and I had read that the tmp folder was openly shared.

        Then, from the Zee's Linux Tools Command Line, I attempted to run

        sudo cp /tmp/entrust_l1k.cer /usr/share/ca-certificates/

        Wouldn't that be all I need?

        The Zee windows displayed
        running command sudo cp /tmp/entrust_l1k.cer /usr/share/ca-certificates/

        And that was it.
        Using WinSCP, I could see that no file was copied.

        Am I close?
        That is the correct unix command. I don't anything about the Zee's Linux Tools Command Line to assist as to why that doesn't work. It's possible that the account you signed into the Linux Tool CLI doesn't have the necessary sudo access to execute the command.

        Comment


        • #5
          Ahh ok, I am assuming that I don't have the necessary rights to access that folder.
          All I can sign in with, is the default "Homeseer" ID provided by them.
          Guess I'm hosed with this particular plugin.
          Rats.
          Thanks for your help. If you have any other suggestions, boy I'm all ears because I was really loving this plugin.

          Comment

          Working...
          X