I want to use WinSCP to connect to the Raspberry Pi standard SFTP server. I also need to have root access. How can I do this without logging in as root (using sudo)?
1 Answer
This is easy. By default the stfp-server of a Raspberry Pi is located at: /usr/lib/sftp-server, so we need to get WinSCP to execute it with sudo.
- Go to your WinSCP profile (Session > Sites > Site Manager)
- Click on Edit > Advanced... > Environment > SFTP
- Insert
sudo su -c /usr/lib/sftp-server
at "SFTP Server" - Save and connect
-
1For more details see WinSCP FAQ How do I change user after login (e.g. su root)? Commented Oct 20, 2017 at 5:55
-
Strangely, you can still encounter permission errors if you try to duplicate a file. I had to download the file, rename it locally, then reupload. Commented Sep 9, 2018 at 3:49