[linux] 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.

Im 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?

Thanks

This question is related to linux sudo winscp

The answer is


There is an option in WinSCP that does exactly what you are looking for:

enter image description here

enter image description here


Tagging this answer which helped me, might not answer the actual question

If you are using password instead of private key, please refer to this answer for tested working solution on Ubuntu 16.04.5 and 20.04.1

https://stackoverflow.com/a/65466397/2457076


I know this is old, but it is actually very possible.

  • Go to your WinSCP profile (Session > Sites > Site Manager)

  • Click on Edit > Advanced... > Environment > SFTP

  • Insert sudo su -c /usr/lib/sftp-server in "SFTP Server" (note this path might be different in your system)

  • Save and connect

Source

AWS Ubuntu 18.04: enter image description here


I do have the same issue, and I am not sure whether it is possible or not,

tried the above solutions are not worked for me.

for a workaround, I am going with moving the files to my HOME directory, editing and replacing the files with SSH.


Usually all users will have write access to /tmp. Place the file to /tmp and then login to putty , then you can sudo and copy the file.


Examples related to linux

grep's at sign caught as whitespace How to prevent Google Colab from disconnecting? "E: Unable to locate package python-pip" on Ubuntu 18.04 How to upgrade Python version to 3.7? Install Qt on Ubuntu Get first line of a shell command's output Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running? Run bash command on jenkins pipeline How to uninstall an older PHP version from centOS7 How to update-alternatives to Python 3 without breaking apt?

Examples related to sudo

Composer: file_put_contents(./composer.json): failed to open stream: Permission denied How to run SUDO command in WinSCP to transfer files from Windows to linux How to install Intellij IDEA on Ubuntu? pip install: Please check the permissions and owner of that directory How to use sudo inside a docker container? How to fix 'sudo: no tty present and no askpass program specified' error? npm install errors with Error: ENOENT, chmod npm throws error without sudo Is it acceptable and safe to run pip install under sudo? Command not found when using sudo

Examples related to winscp

how to get the ipaddress of a virtual box running on local machine Upload file to SFTP using PowerShell How to run SUDO command in WinSCP to transfer files from Windows to linux WinSCP: Permission denied. Error code: 3 Error message from server: Permission denied Is there any WinSCP equivalent for linux? What are some good SSH Servers for windows?