0

I need to run shell scripts (shutdown scripts for tomcat) with the tomcat user out from a C# .NET application.

I tried with the WinSCP .NET assembly. I can login via ssh and run commands.

But how to run sudo su tomcat first with the same password I already used to login the SSH server?

A secure solution would be great (no passwords in log files or bash history)!

Maybe any other solution instead of WinSCP .NET assembly?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992

1 Answers1

0

The sudo/su are made not to be automatable. For a good reason.

So any solution will be a dirty and unreliable hack.

If you need to be able to allow an automatic run of some command, allow it to be run without a password in sudoers. That's the correct and transparent solution.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992