How to connect as root using WINSCP
Refer: https://blog.jamesbayley.com/2014/01/28/how-to-connect-as-root-using-winscp/
In my previous post I noted that I had not succeeded in in connecting to a linux machine as root using WINSCP when using the bitnami virtual machine.
My development implementation works, so I have progressed to using the cloud hosted bitnami instance. This comes with public key access rather than password access. This actually make it easier to connect.
- Download your private key, if using bitnami use the cloud console, if using AWS use the AWS console. Store it with no spaces in the file name.
- Optionally put it into your Pageant keystore
- Verify that you can connect using PuTTY
You now have two choices, you may use the SFTP protocol or the SCP protocol. My experience shows that connecting with SCP is easier.
USE the SCP protocol (preferred)
- Test connecting with WINSCP using using the SCP protocol and the bitnami (low priviledge user) and your private key.
- On the Advanced tab of WINSCP specify the Shell
to be
i) sudo su-
Use the SFTP protocol
- Test connecting with WINSCP using the SFTP protocol using the bitnami (low priviledge user) and your private key.
- Find the location of the sftp server, you will enter
this into WINSCP later
[root@test /]# locate sftp-server
- On the Advanced tab of the WINSCP specify the sudo -s
command to run the server as su. This works because you are using PKI and
are not asked to provide a password when you sudo.
i) sudo su -c /usr/libexec/openssh/sftp-server or sudo -s /usr/libexec/openssh/sftp-server