Tuesday, May 14, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 1267  / 1 Year ago, fri, december 30, 2022, 8:29:20

I am currently working on a windows 10 laptop. I have installed the ubuntu subsystem (instead of PUTTY) in it to access the remote server. When I launch the ubuntu subsystem from my windows start menu, it opens with a command prompt user@PC0BCD-PC


The remote server is a Linux server as well.


In addition, I am connected to a VPN. If I don't connect to the VPN, I will not be able to login to the remote server.


So, what I would like to do is transfer the file from my local windows ubuntu subsystem to the remote server


So, i tried the below command and got an error as shown below


scp /mnt/c/Users/test/Downloads/DC_cond.csv [email protected]:/home/test/cond_occ.csv

ssh: connect to host 172.XX.YYY.Z port 22: Resource temporarily unavailable
lost connection

/mnt/c/Users/.... indicates the path in my local system whereas [email protected] indicates my remote server address.


when I type telnet 172.XX.YYY.Z 22 in my WSL, it just says Trying 172.XX.YYY.Z whereas when I SSH into remote server and type telnet 172.XX.YYY.Z 22, it produces output for telnet command


Am unable to transfer files from remote server to local system as well.


Can help me with this?


More From » networking

 Answers
5

From the comments, we discovered that the "core issue" was that you were able to access the server when ssh, and from there you could scp. But when attempting to scp directly into the server from your WSL session on the VPN, it was not accessible.


For future readers, there could be several (other) reasons for scp not working when ssh does:



  • There could be a server issue. Some servers running certain versions of libssh2 are reported to have an issue with scp, although that has been fixed for a while, so it would be rare to see this.



  • The shell startup files on the server could be emitting some text. This would work with an interactive ssh session, but would cause issues with scp. However, the error messages that you are seeing aren't quite aligned with that.




It turns out, it seems, that you were using the hostname with ssh, but you were attempting to use the IP address with scp. The hostname worked, because you have the following in your ~/.ssh/config:


Host server_1
Hostname 172.xx.yyy.z
User test
ProxyCommand ssh -q -a pitunnel -W %h:%p
TCPKeepAlive yes

This allowed the ssh server_1 to use the ProxyCommand to connect through a server on the VPN named pitunnel to server_1.


While you already discovered that you can simply use the server_1 hostname with scp to get it to work (since it also reads the same ~/.ssh/config), you should be able to also modify the config to allow access hostname and IP. Just change the first line to be:


Host server_1 172.xx.yyy.z

This tells ssh and scp to use the settings below for both hostname and IP.


One additional note. You are smart to obscure the IP address, but it likely isn't necessary in this case. If xx is between 16 and 31, then the IP address is on what is known as a "Private Internet" network. It's just like the 192.168.1.1 type addresses that you see on your home router. Everyone can use the same IP ranges, because they aren't routable over the public Internet.


That's why you have to connect to the VPN and use a proxy to access it. It isn't on the public Internet to begin with.


[#1761] Saturday, December 31, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ainlyyor

Total Points: 210
Total Questions: 129
Total Answers: 116

Location: Barbados
Member since Sun, Nov 27, 2022
1 Year ago
ainlyyor questions
Sun, Jun 19, 22, 23:36, 2 Years ago
Sun, Jan 29, 23, 10:33, 1 Year ago
Sat, Feb 4, 23, 18:19, 1 Year ago
Sat, May 29, 21, 19:45, 3 Years ago
;