Results 1 to 6 of 6

Thread: Please help with Secure Copy

  1. #1
    Join Date
    Nov 2007
    Location
    US
    Beans
    51
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Please help with Secure Copy

    I'm trying to copy a file using secure copy and I can't find a way to make it work.

    I used SSH to connect to remote host and tried to push file to local client and also tried to pull file from local client. Neither way is working. I either get unable to resolve host message, cannot stat file, or connection time out. The name of the file is config.sys and I am using the following format:

    scp config.sys jaraxle@localhost:/home/jaraxle/config.sys

    I have also tried to copy file into root directory:

    scp config.sys root@localhost:~/

    Neither way is working. This is my first time using scp but the instructions seem clear and I don't see what I'm doing wrong.
    Last edited by Jaraxle; July 13th, 2013 at 03:51 AM.

  2. #2
    Join Date
    Apr 2012
    Beans
    5,285

    Re: Please help with Secure Copy

    Is the config.sys file in the directory that you're executing the scp command from? If not, you need to give the path to the file as well as a path to the destination (which must be writeable) i.e. from a shell the local machine (NOT ssh'd into the remote machine - scp does that part for you)

    Code:
    scp /path/to/config.sys jaraxle@192.168.1.16:/home/jaraxle/config.sys
    where in this case 192.168.1.16 is the IP of the destination machine - you can use a hostname provided it is resolvable

  3. #3
    Join Date
    Nov 2007
    Location
    US
    Beans
    51
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Please help with Secure Copy

    Forgot to mention that config.sys is in the directory I'm executing scp command from. However, I was trying to push from remote server to client. Using your advice, I'm now executing command from local machine. The file is in the root directory of remote server so I am trying using the following format:

    scp ~/config.sys jaraxle@192.168.1.16:/home/jaraxle/config.sys

    Host name is not resovable so I am using ip (had tried both before) but getting connection refused on port 22.

    I can ping remote host and also ssh into host. Could part of the problem now be the fact that I disable password login on remote host (using authentication keys with same user name as login)? Also disabled root login on server but user account has sudo privileges.

    It's really frustrating because I am so close and I know it's something that I'm overlooking. I just installed sshfs command on server and am trying to learn that command to see if that method will work.

  4. #4
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Please help with Secure Copy

    Why not just use rsync? It supports keys and can be set to function like scp.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  5. #5
    Join Date
    Apr 2012
    Beans
    5,285

    Re: Please help with Secure Copy

    If you are trying to copy the file FROM the root dir of the remote machine TO the current directory on your local machine, that would be

    Code:
    scp jaraxle@192.168.1.16:/config.sys ./

  6. #6
    Join Date
    Nov 2007
    Location
    US
    Beans
    51
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Please help with Secure Copy

    That did it. Thanks a lot, steeldriver!

    The ending ./ was different than the examples I was using and what I was trying was wrong. I also didn't realize that scp would log in for you (duh!) and to run it from the directory where you wanted to place the file. I think that was the main thing I was doing wrong.

    Definately showed me that I need to read more about scp and rysnc before I start trying to do too much but I wanted to finish this job and was thrilled when I saw the file copy over! Thanks again to everyone who responded.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •