How do I send "sudo /usr/lib/openssh/sftp-server" in .NET

Advertisement

elrod_johnson
Joined:
Posts:
1
Location:
earth

How do I send "sudo /usr/lib/openssh/sftp-server" in .NET

I'm connecting to an EC2 Ubuntu server.
WinSCP works fine in the GUI when I set Advanced Site Settings > Environment > SFTP > Protocol options > SFTP server = sudo /usr/lib/openssh/sftp-server
How do I do this in C# .NET?

Here's the WinSCP.ini section I'm trying to duplicate in .NET:
[Sessions\ec2-server]
HostName=<ip>
UserName=ubuntu
PublicKeyFile=<ppk filepath>
LocalDirectory=<local dir>
RemoteDirectory=<remote dir>
SftpServer=sudo%20/usr/lib/openssh/sftp-server  <<<--- how do i do this in .net
I did see session.AddRawConfiguration, but can't figure out the correct .ini setting

Thanks

SOLVED – with help from https://winscp.net/eng/docs/ui_generateurl
The Generate Session URL/Code is a very useful feature.

Correct format is:
sessionOptions.AddRawSettings("SftpServer", "sudo /usr/lib/openssh/sftp-server");
not
session.AddRawSettings("SftpServer", "sudo /usr/lib/openssh/sftp-server");
Like I was trying.

Reply with quote

Advertisement

You can post new topics in this forum