Code Robo
Java Code Complience
Virtual Service
How to run SUDO command in WinSCP
       Talk to EasyAssistant

How do I login as a root in WinSCP.

This page tells you how to connect in WinSCP with root user or how to run sudo su command from WinScp after login. I was connecting through WinSCP to transfer files from my windows laptop to a RED Hat linux machine in AWS cloud. I was using private key for authentication. However the files was not getting transfered as the user account to be used had to have root access. For this task, We need to elevate to root user after login.

Now question is how can I elevate a loged in user to root user in WinScp (SFTP) or How can I run sudo su When I am using WinScp to upload or downlod files.

Good news is that , WinSCP can elevate loged in user to root after login if we set up some values;

Please follow the following steps.

1. Login to your linux m/c using Putty and find location of sftp-server location. It varies from OS to OS

 sudo su
 cd /
 find -name sftp-server

In my linux (RedHat)m/c path is : /usr/libexec/openssh/sftp-server

sft-server location in linux m/c

2. Open WinScp. Navigate to (Session > Sites > Site Manager)

WinScp site manager

3. Select the saved session and click on the "Edit" button.

click on edit button

4. Click on Advanced button. Then navigate to SFT > SFTP Server.
Set the value sudo su -c /usr/libexec/openssh/sftp-server

click on edit button

5. Save the value and login.
WinScp Login

Now you should be logged in succesfully and current user will be elevated to root user. I mean current user will have root access.

User Comments:
anonymous (2022-11-23) :
Thank easycodeforall team for putting it nicely with screenshots! This is what I was looking for!!!!!!!!!!!!
easycodeforall: (2022-12-07)
Thanks for using easycodeforall

anonymous (2023-05-18) :
Thanks! Helped me get root on WinSCP

anonymous (2023-09-01) :
I have tried so many things and finally i got this. Thank you so much for this tutorial.
easycodeforall: (2023-09-01)
Thanks for using easycodeforall and sharing your comments!

Post Your Comment:
Name :
Email ( Optional) :
Comments / Suggestion (* Required) It is required: :