How to run SUDO command in WinSCP to transfer files from Windows to linux


I am trying to use WinSCP to transfer files over to a Linux Instance from Windows.

I’m using private key for my instance to login to Amazon instance using ec2-user. However ec2-user does not have access to write to the Linux instance

How do I sudo su – to access the root directory and write to the linux box, using WinSCP or any other file transfer method?



AFAIK you can’t do that.
What I did at my place of work, is transfer the files to your home (~) folder (or really any folder that you have full permissions in, i.e chmod 777 or variants) via WinSCP, and then SSH to to your linux machine and sudo from there to your destination folder.

Another solution would be to change permissions of the directories you are planning on uploading the files to, so your user (which is without sudo privileges) could write to those dirs.

I would also read about WinSCP Remote Commands for further detail.

Answered By – Idos

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published