Results 1 to 9 of 9

Thread: How to copy the file from a remote server to my laptop?

  1. #1
    Join Date
    Apr 2014
    Beans
    7

    How to copy the file from a remote server to my laptop?

    Hi, I need to copy some files from a server in university. I've logged in the server through my laptop. And find the folder of the file I need, but I don't know how to copy.

    I've tried
    scp <file> <username>@<IP address or hostname>:<Destination>

    but it doesn't work. My laptop is connected wifi, is that make a different?

  2. #2
    Join Date
    Apr 2012
    Beans
    Hidden!

    Re: How to copy the file from a remote server to my laptop?

    hi here is a link to give you some ideas..
    http://www.hypexr.org/linux_scp_help.php

    note that you do not do...ssh scp bla bla bla
    it is scp only. common error when learning

    also...man scp or google it.

    have fun.
    Craving anchovy, herring and squid pizza.....with clam sauce

  3. #3
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: How to copy the file from a remote server to my laptop?

    Are you running openssh-server on the destination machine? You need that so scp can set up an SSH tunnel. Run "sudo apt-get install openssh-server" on your machine and see if that helps.

    It's also not obvious what you mean when you say you are "connected" to the remote server? Are you logged in on that machine, or do you just have access to file shares? If you are logged in on the remote, can you run a mail client (even maybe alpine)? Then you could just mail the files to yourself.

    If the remote server supports SSH access, then you could try copying the files to your computer by using
    Code:
    scp user@remote:/path/to/some/file /path/to/local/destination
    Last edited by SeijiSensei; April 10th, 2014 at 04:06 AM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  4. #4
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,790
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: How to copy the file from a remote server to my laptop?

    Hi peng2.

    I imagine that you're connecting to the server from home, so you have a router and you're behind NAT.

    In this case, you would have to have resolved all issues to connect remotely from the Internet to your server at home in order to 'push' the files from the server.

    Since you have remote ssh access to the server, I'd recommend 'pulling' the files from your computer.

    Open a terminal, do not connect to the server, and run locally something like:
    Code:
    scp serveruser@remoteserver:path/to/file  ./
    Hope it helps. Let us know how it goes.
    Regards.

  5. #5
    Join Date
    Oct 2005
    Location
    Lab, Slovakia
    Beans
    10,792

    Re: How to copy the file from a remote server to my laptop?

    "I've logged in the server through my laptop."
    So now you are at the server. If you want to copy from there, you got to run a SSH server on your laptop as well, which you probably won't be able to do due to a firewall somewhere.

    Log out of the server. From your laptop local prompt, do scp with the full path of the file on the server.

  6. #6
    Join Date
    Apr 2014
    Beans
    7

    Re: How to copy the file from a remote server to my laptop?

    Many thanks to you all! Problem solved.

  7. #7
    Join Date
    Apr 2014
    Beans
    7

    Re: How to copy the file from a remote server to my laptop?

    yeah, you're right. 'pulling' files from remote server works fine. Thanks for help.

  8. #8
    Join Date
    Apr 2014
    Beans
    7

    Re: How to copy the file from a remote server to my laptop?

    Quote Originally Posted by papibe View Post
    Hi peng2.

    I imagine that you're connecting to the server from home, so you have a router and you're behind NAT.

    In this case, you would have to have resolved all issues to connect remotely from the Internet to your server at home in order to 'push' the files from the server.

    Since you have remote ssh access to the server, I'd recommend 'pulling' the files from your computer.

    Open a terminal, do not connect to the server, and run locally something like:
    Code:
    scp serveruser@remoteserver:path/to/file  ./
    Hope it helps. Let us know how it goes.
    Regards.

    Hi papibe, I have another question. If I want to 'push' the file from the remote server to my local folder, how should I do it?

  9. #9
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,790
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: How to copy the file from a remote server to my laptop?

    Quote Originally Posted by peng2 View Post
    Hi papibe, I have another question. If I want to 'push' the file from the remote server to my local folder, how should I do it?
    There a few ways to accomplish that. First you need a service running on your home computer. The common tools most of us use is openssh, as SeijiSensei suggested. Install it like this:
    Code:
    sudo apt-get install openssh-server
    As an easy, and temporary solution, you can use a reverse ssh tunnel:

    On your home machine connect to the server:
    Code:
    ssh -R 23456:localhost:22  serveruser@remoteserver
    enter the password and login normally.

    You have created a reverse tunnel from the server on port 23456 to your home computer's port 22 (sshd). Now you can run this on the current session on the server and 'push' the file to your home machine:
    Code:
    scp -oPort=23456  /path/to/file  your_home_machine_user@localhost:
    Once you have copied your file, you logout and the reverse tunnel is destroyed.

    For a permanent way to access your home computer from the Internet take a look at this post here.

    Hope it helps.
    Regards.

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
  •