1

For research purposes, I use the University server.

The server login is a two-step process.

First, I type

ssh -p 44  [email protected]

(Altered for security reason)

Then the password is prompted. I type the credential

Then I type

ssh [email protected]

Then the password is prompted. I type the credential

Now if I have to transfer a file (say a pdf file namely first.pdf) to the working directory I use the following code

scp - P 44 first.pdf [email protected]:~/

scp first.pdf [email protected]:~/

Until here it is clear My doubt begins after this

  1. If I have to bring back the first.pdf from the final working directory to the local machine. (working computer).

How to do it?

  1. I was able to access the intermediate directory ([email protected]:~/) through Filezilla. But I was not able to access the final main directory through Filezilla. I tried through other software such as winscp neither it worked. The GUI software generally has a single tab for typing username and password. But here I have 2 step login process. Hence the whole confusion.

How to access the final working directory through a GUI software.

Praveen Kumar-M
  • 584
  • 5
  • 14
  • 2
    Related: [How can I download a file from a host I can only SSH to through another host?](https://unix.stackexchange.com/q/537319/315749), [Transferring files between a server and a PC through another server (who was size limitations)](https://unix.stackexchange.com/q/393344/315749), [Is there a way to use sshfs for a machine “two jumps away”?](https://unix.stackexchange.com/q/495845/315749). – fra-san Aug 30 '20 at 09:56

2 Answers2

2

rsync command can help you with:

rsync -av -e "ssh -p 44 [email protected]" [email protected]:~/first.pdf ./

The server [email protected] will be used as a proxy to reach the file on remote host. The file first.pdf will be copied on your local machine.

maruscya
  • 71
  • 3
  • 1
    Are you sure about your command's syntax? I get an error (too long for reporting it here in a comment), while `rsync -av -e "ssh -J [email protected]:44 [email protected]" :~/first.pdf ./` works. Also, I think the "proxy" in the question would be `[email protected]`. – fra-san Aug 29 '20 at 21:43
  • @maruscya I got the following error code on using your codes ```rsync: connection unexpectedly closed (0 bytes received so far) [Receiver] rsync error: remote command not found (code 127) at io.c(235) [Receiver=3.1.2]``` – Praveen Kumar-M Aug 30 '20 at 03:57
  • @fra-san please post your comment as an answer. It really worked great. I was not able to find the answer easily in any forum, so it would be greatly beneficial to have it as an accepted answer. – Praveen Kumar-M Aug 30 '20 at 04:02
  • @fra-san is there a way to access the same folder using a GUI – Praveen Kumar-M Aug 30 '20 at 04:09
  • @fra-san is there a way to transfer the file to the final working directory in a single step – Praveen Kumar-M Aug 30 '20 at 06:09
  • 1
    @PraveenKumar-M I'm not fond of posting answers differing from existing answers on syntax details only. Better to have the existing answers improved ;-) Here, it should be enough to just change `-p 44 [email protected]` to `-J [email protected]:44`. Note that `--debug=CMD` (if your version of rsync supports it) is very handy to debug command line errors. – fra-san Aug 30 '20 at 10:17
1

WinSCP actually supports connecting via an SSH jump server.

Just specify connection data for your intermediate server on the Tunnel page of the advanced site settings.

See also WinSCP guide for Connecting to FTP/SFTP server which can be accessed via another server only.


For Linux command-line solutions, see:
How can I download a file from a host I can only SSH to through another host?

Martin Prikryl
  • 2,186
  • 15
  • 21