Results 1 to 10 of 10

Thread: Using SCP to transfer files over SSH?!!

  1. #1
    Join Date
    Oct 2007
    Beans
    33

    Smile Using SCP to transfer files over SSH?!!

    I'm going to do my best to try to explain the complex situation I'm in:

    My hostnames:
    LAPTOP
    HOMEPC

    Username: sysadmin on both LAPTOP and HOMEPC

    My goal was to use my LAPTOP from another state (and another isp) to access my HOMEPC in California. I've configured my HOMEPC to wakeonlan through the internet using dyndns.org and I can ssh to my HOMEPC through my LAPTOP from another isp just fine. I can browse the directories, etc.

    I am having trouble figuring out how to copy files from my HOMEPC to my LAPTOP through ssh as both are on different isps and not on a wlan.

    I tried using scp but I get the following output:
    Code:
    sysadmin@LAPTOP:~$ ssh XXXX.dyndns.org
    sysadmin@XXXX.dyndns.org's password:
    
    Linux HOMEPC 2.6.24-16-generic #1 SMP Thu Apr 10 13:23:42 UTC 2008 i686
    
    The programs included with the Ubuntu system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    
    Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
    applicable law.
    
    To access official Ubuntu documentation, please visit:
    http://help.ubuntu.com/
    Last login: Thu May 22 20:12:34 2008 from adsl-XXXXXX.net
    
    sysadmin@HOMEPC:~$ scp oc.mov sysadmin@HOMEPC:/Desktop sysadmin@LAPTOP:/Desktop
    ssh: LAPTOP: Name or service not known
    lost connection
    So it seems like it's not recognizing my hostname of LAPTOP, which is the actual computer I am on and using... I noticed that my "hostnames" change while I am on the LAPTOP: when I open a console it says sysadmin@LAPTOP but as I ssh into my HOMEPC, the console title changes to sysadmin@HOMEPC, as shown above.

    Again, through ssh I can browse through my LAPTOP all the files on HOMEPC, but I can't figure out how to copy them over through the internet using ssh... There's something trivial missing here I think.

    What am I doing wrong?

    Thanks in advance. If you need more info please request.
    Last edited by FilmAficionado; May 23rd, 2008 at 04:45 AM.

  2. #2
    Join Date
    Feb 2008
    Location
    US
    Beans
    2,782
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Using SCP to transfer files over SSH?!!

    dont put the hostname in. instead put in the local ip. This would be something like 192.168.1.101
    Desktop: Q6600 OC: 343 x 9, 4 GB RAM, 8600 GTS Twinview (22",17"), 1.5 TB RAID 5
    Laptop: Lenovo T61 T7300 @ 2 GHz, 2GB RAM, Nvidia 140M Quadro, 160 GB harddrive
    Remember to mark posts as [SOLVED] when your problem is resolved

  3. #3
    Join Date
    Jul 2005
    Location
    Sydney
    Beans
    2,543
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: Using SCP to transfer files over SSH?!!

    I'm not entirely sure what you're trying to do. Are you trying to copy the file 'oc.mov' on HOMEPC to your laptop?

    What your command is actually asking to do is to copy 'oc.mov' and the contents of /Desktop on HOMEPC to /Desktop on LAPTOP. This is unlikely to work, for a number of reasons, but the reason that you probably care about the most is it requires an SSH server on your laptop.

    Probably what you meant to say was
    Code:
    user@LAPTOP> scp username@HOMEPC:~/Desktop/oc.mov .
    to copy the ~/Desktop/oc.mov file on HOMEPC to the current directory. This won't require an SSH server on your laptop.

    In particular, you don't need to be logged in to the remote system with SSH before you can use scp. SCP creates its own SSH connection.
    Last edited by RAOF; May 23rd, 2008 at 04:52 AM.
    Remember: if your problem is not described on a Launchpad bug, it can only be fixed by accident!

  4. #4
    Join Date
    Oct 2007
    Beans
    33

    Re: Using SCP to transfer files over SSH?!!

    Quote Originally Posted by tamoneya View Post
    dont put the hostname in. instead put in the local ip. This would be something like 192.168.1.101
    Thanks for the quick reply.

    If I use
    Code:
    scp oc.mov 192.168.1.100
    it just does it and doesn't display anything. So I'm not sure anything got copied over. Where would I look since no directory was specified?

    If I specify the directory:
    Code:
    scp oc.mov 192.168.1.100:/Desktop
    ssh: connect to host 192.168.1.100 port 22: Connection refused
    lost connection

  5. #5
    Join Date
    Feb 2008
    Location
    Townsville, Qld Australia
    Beans
    1,065

    Re: Using SCP to transfer files over SSH?!!

    Just to clarify what RAOF said you use this command WITHOUT first connecting to HOMEPC with ssh. Incase you were unaware there are much easier ways to do this, for example with nautilus you can open ssh://HOMEPC or if your laptop uses windows you can use winSCP, both of these will give you normal file browser interfaction (although they may be a little slow depending on your connection)
    Registered Linux User #464572
    journal.ryanhaigh.net
    www.ryanhaigh.net

  6. #6
    Join Date
    Oct 2007
    Beans
    33

    Re: Using SCP to transfer files over SSH?!!

    Quote Originally Posted by RAOF View Post
    I'm not entirely sure what you're trying to do. Are you trying to copy the file 'oc.mov' on HOMEPC to your laptop?

    What your command is actually asking to do is to copy 'oc.mov' and the contents of /Desktop on HOMEPC to /Desktop on LAPTOP. This is unlikely to work, for a number of reasons, but the reason that you probably care about the most is it requires an SSH server on your laptop.

    Probably what you meant to say was
    Code:
    user@LAPTOP> scp username@HOMEPC:~/Desktop/oc.mov .
    to copy the ~/Desktop/oc.mov file on HOMEPC to the current directory. This won't require an SSH server on your laptop.

    In particular, you don't need to be logged in to the remote system with SSH before you can use scp. SCP creates its own SSH connection.
    Owch my mind is boggling. Ok it's good that I know what I was doing was wrong.

    Ok so I won't connect to SSH first. Just a clean terminal now..
    So yes, what I'm trying to do is "copy 'oc.mov' on HOMEPC to your laptop?"

    OK perfect. So I did exactly what you suggested and after some trial and error implanting the dyndns url, it WORKS..:

    Code:
    sysadmin@LAPTOP:~$ scp sysadmin@XXXX.dyndns.org:~/Desktop/oc.mov 192.168.1.100
    sysadmin@XXXX.dyndns.org's password: 
    oc.mov                                        100%   34MB   1.9MB/s   00:18
    Success! Thank you both so much!
    I'm a fairly new Linux user and I love all the support that I've been getting.
    Thanks again. This is awesome

  7. #7
    Join Date
    May 2008
    Location
    Melbourne, Australia
    Beans
    157

    Re: Using SCP to transfer files over SSH?!!

    Quote Originally Posted by FilmAficionado View Post
    Thanks for the quick reply.

    If I use
    Code:
    scp oc.mov 192.168.1.100
    it just does it and doesn't display anything. So I'm not sure anything got copied over. Where would I look since no directory was specified?
    That's because you didn't put a colon on the end of the IP address, so all it did was copy the file locally.

    Try:

    Code:
    scp oc.mov 192.168.1.100:

  8. #8
    Join Date
    Oct 2007
    Beans
    33

    Re: Using SCP to transfer files over SSH?!!

    Quote Originally Posted by pdwerryhouse View Post
    That's because you didn't put a colon on the end of the IP address, so all it did was copy the file locally.

    Try:

    Code:
    scp oc.mov 192.168.1.100:
    Oops. So I spoke too soon.
    So the file did indeed get copied over as my post before showed.

    But I browsed around my laptop and found it in /home/sysadmin/ named 192.168.1.100 (with the extension being .100 instead of .mov ) VLC still played it, but now what code would I use to actually get it copied over with the right file name and extension onto my desktop folder on my laptop?

  9. #9
    Join Date
    Feb 2008
    Location
    Townsville, Qld Australia
    Beans
    1,065

    Re: Using SCP to transfer files over SSH?!!

    Code:
    scp sysadmin@XXXX.dyndns.org:~/Desktop/oc.mov .
    This just copies the file to the current directory, because you specified 192.168.1.100 as the target scp renamed the copied file to that.
    Last edited by ryanhaigh; May 23rd, 2008 at 05:12 AM.
    Registered Linux User #464572
    journal.ryanhaigh.net
    www.ryanhaigh.net

  10. #10
    Join Date
    Oct 2007
    Beans
    33

    Re: Using SCP to transfer files over SSH?!!

    Quote Originally Posted by ryanhaigh View Post
    Code:
    scp sysadmin@XXXX.dyndns.org:~/Desktop/oc.mov .
    This just copies the file to the current directory, because you specified 192.168.1.100 as the target scp renamed the copied file to that.
    Ahh. That was me being stupid.

    Code:
    scp sysadmin@XXXX.dyndns.org:~/Desktop/oc.mov Desktop/oc.mov
    Works perfectly now.
    Thanks for pointing that out.

    Thanks again all!

Tags for this Thread

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
  •