How to sudo su - newuser in C#

Advertisement

vipul
Joined:
Posts:
2
Location:
NJ

How to sudo su - newuser in C#

Hi All,

I am logging in with my UserID - vipul123. My account has necessary sudo privilegs and I can sudo su - newuser using GUI of WinSCP.

I am successfully able to Open the connection and access the SFTP in C# code using my userID - vipul123.
Now, I want to do sudo su - newuser in C# code after I login with my UserID - vipul123.

How can I do the same?
Please help me.

Thanks in advance,
Vips

Reply with quote

Advertisement

vipul
Joined:
Posts:
2
Location:
NJ

Re: How to sudo su - newuser in C#

Hi Martin,

I added below code after instantiating sessionOptions and sudo su - newuser worked after that.
sessionOptions.AddRawSettings("Shell", "sudo%20su%20-%20newusername");
sessionOptions.AddRawSettings("RemoteDirectory", "/desired_path_accessible_by_newuser");
Thank you for the help,
Vips

Reply with quote

Advertisement

You can post new topics in this forum