Posting the solution as obviously the top result for searching online falls on an admin that is unable to provide the simple answer...
Quick answer:
sudo -u RunAsUser /path/to/sftp-server
To locate /path/to/sftp-server:
If both command fails, try the paths in the doc:
https://winscp.net/eng/docs/faq_su
Long answer:
Basically the
SFTP server field in Advanced Settings is a command line, so you only need to add the command to sudo as another user.
What is suggested in the official doc is to just elevate
sftp-server
permission to
root
(default value if
-u
is not provided). As
-u
is not required for
root
, it can get confusing as to how to set up the connection as another user.
- Elevate
sftp-server
to root
permission.
Requires the permission to be set in sudoers.conf
sudo /path/to/sftp-server
- Elevate
sftp-server
to another user permission
Requires the permission to be set in sudoers.conf
sudo -u RunAsUser /path/to/sftp-server
- Another command that I found being passed around is
sudo su RunAsUser -c /path/to/sftp-server
It achieves the same thing in a different manners. Either worked for me.