Score:1

I can do ssh from server to local pc but not from pc to server

es flag

I can successfully ssh my local pc to remote server in a different network. But reverse is not working (server to local pc). I need to transfer the large files from server to my local pc and for that I wanted to use scp but before that I think first step is to get the ssh working. please guide.

hr flag
If you can ssh to the server from your PC, then you should be able to use something like `scp user@server:/path/to/bigfile somewhere/on/pc/` to transfer `bigfile` to your PC. There should be no need to connect from the server to the PC explicitly.
es flag
thanks , worked, i am using winscp to connet and transfer files to and from the server
Score:2
us flag

You do not need the server to ssh into your pc to send files from the server to your PC. All you need to do is enter what @steeldriver said in his comment (which was to use scp user@server:/path/to/bigfile somewhere/on/pc/).

If you still need to ssh into your PC for some reason you could try making sure that OpenSSH server is installed/installing it.

(These instructions are for Windows, as I am presuming that's what your PC's operating system is by the fact you are using winscp)

Search for Manage optional features in the start menu, click on the top result -> select Add a feature at the top of the now open settings page --> type into the search box OpenSSH Sever --> select OpenSSH Server --> click install (1) at the bottom left.

After it has finished installing, you will need to open Powshell as Administrator, and type Start-Service ssh to start it, or Set-Service -Name sshd -StartupType 'Automatic' to make it startup automatically.

For more information, you can look at Microsoft's tutorial here.

This should allow you to be able to receive SSH connections on a Windows 10 PC.

Make sure that OpenSSH service is allowed through Windows Firewall.

Also, I just wanted to mention that you do not need to use a thirdparty software like winscp to use ssh/scp on Windows, as OpenSSH has been part of Windows for a couple of years now. You can use ssh in the Windows cmd the same way you would in Linux Terminal. (E.g. ssh <user>@<ip-address>)

Score:0
aw flag

I would recommend usage of rsync over scp.

rsync gives much greater speed, and a resume capability in case the copy gets halted in between.

Pic from stack overflow (source is cited in references)

Usage:

# To copy files from a remote server to local machine
# =======> answer to your question <========================================
rsync -av [email protected]:/path/to/resource /path/to/dst/on/local/machine

# To copy files from local machine to remote server
rsync -av /path/to/dst/on/local/machine [email protected]:/path/to/resource 

# Go through manual pages for more information on rsync
man rsync

Also, if you are using a local ISP for internet, you might get a local ip address (something like 192.168.0.{0-254}), and the server has a fixed IP address (something like 100.172.34.26).

So the destination has a unique location, accessible from any ip, but the local machine IP address is masked (not exposed) to the entire internet, and that is the reason why you can't ssh from the remote server to your local machine.

References:

anuraag tummanapally avatar
aw flag
Does this answer the question, and solve the problem?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.