0

Suppose this setting:

  • Full access on local machine
  • The proxy server is accessible via SSH but only allows 2 specific commands:
    • exit - closes the connection
    • ssh remote - establishes an SSH connection to the remote
  • The remote server gives restricted access:
    • ssh is not installed
    • scp is installed but can't connect to any remote machine (would need ssh)
    • Most basic commands like cat, mv, rm, echo, etc. are available

A connection to the remote can not directly be established.

The task: Copy a file from the remote to the local machine.

Any ideas?


Note: The file to copy is about 170 MB, so base64 -w 0 < file.bak gives an output which I can not handle by copy and paste on my local machine.

Matmarbon
  • 123
  • 5
  • Is it possible to send a command to the remote server? like: ssh remote "cat remote.file" > local.file ? – Alexander Makarenko Nov 24 '17 at 09:57
  • You mean from the proxy? Lemme try... No, he just ignores everything after `ssh remote`. As if there were no further arguments given to the command. – Matmarbon Nov 24 '17 at 10:02
  • are all ssh access via keys (and using ssh-agent) or do you also have to type password(s)/passphrase(s) to connect ? – A.B Dec 02 '17 at 18:20
  • The connections from proxy to remote work via keys. – Matmarbon Dec 02 '17 at 19:22
  • A bit too broad to make an (exact) answer with it. But you can use `empty` (similar to `expect`) to script the terminal connection to the first ssh, then the 2nd ssh, and actually do what you said with the base64 command, except that the result will be received by empty and can be piped (after decoding) to a file. It's quite possible that you'll also create 170MB of logs on the proxy which when working like this might also be configured to log all terminal activity. On debian the package is called `empty-expect` – A.B Dec 03 '17 at 15:31

0 Answers0