Reputation: 2280
I am new to linux and am having trouble doing this.
I need to download files and this is currently what I do to access the file.
SSH into server A.
From server A, SSH to server B
After logging into server B, run the following command:
sudo -i -u testuser
I enter a password and then I have the privileges I need.
How would I replicate this with WinSCP? I can login to the server following the guide here: https://superuser.com/questions/303486/sftp-over-double-server-hop
But I cannot download the files because I don't have permissions. How do I execute that sudo command and enter a password in the login process using WinSCP? Or an alternative program (that runs on OSX). My ultimate goal is to download a file form the(double remote) computer to my local computer.
Upvotes: 1
Views: 1280
Reputation: 202534
You need to combine two "advanced" features of WinSCP.
Tunneling: That's what the Super User question you have referred to deals with:
SFTP over double server hop
Sudo: There's another Super User question that deals with this:
How to change user in WinSCP?
It is basically covered in WinSCP FAQ How do I change user after login (e.g. su root)?
This is a tricky part.
Upvotes: 1
Reputation: 15917
You can use the solution you've already found, just use:
ssh -o ProxyCommand='ssh myfirsthop nc -w 10 %h %p' testuser@mydestination
Upvotes: 0