Allow root WinSCP File Transfer

If you have spent any time managing a Linux server from a Windows machine, than chances are you are aware of the limitations to this setup. Copying files to the server with non-root access can be a chore to say the least. The following tutorial has been tested on Debian 8 and Ubuntu 16.04. In the tutorial below, we will detail the steps required to enable root file transfer while logging in with WinSCP as a non-root user. Keep in mind that you will still be required to enter your user credentials when using the sudo command in a terminal session through putty.

Note: for the below tutorial to work, the user account you are using to login with WinSCP must be a member of the sudo group.
First, run the command below to create a file in /etc/sudoers.d:

Then in the SFTP setup section of WinSCP, edit the Server session advanced options by adding the command below under Protocol options (advanced edit window pictured below command):

If all the steps above went well, you should now have root access to the file system via WinSCP as a non-root user.

Did you find this article useful? Why not share it with your friends?

5 thoughts on “Allow root WinSCP File Transfer

  1. I follow all your steps but id doesnt work i got this message :
    failed with return code 1 and error message
    usage: sudo -h | -K | -k | -V
    usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
    usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
    [command]
    usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
    prompt] [-u user] [VAR=value] [-i|-s] []
    usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
    prompt] [-u user] file …
    Any idea why is this happening ?

    1. What OS? Can you provide any other info that may help? Make sure “your_username” in the code block above is correct.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.