protoculture-dotnet-postgres icon indicating copy to clipboard operation
protoculture-dotnet-postgres copied to clipboard

Why does not work to be run as admin?

Open ignatandrei opened this issue 3 years ago • 5 comments

Please explain why it cannot run as admin Thanks

ignatandrei avatar Feb 17 '22 15:02 ignatandrei

Hey! I was just as surprised, but apparently postgres errors out and terminates itself when run as admin.

I run postgres directly so that I can monitor the process, so this ended up being a limitation.

When you run pg_ctl as administrator, it's actually spawning the postgres process as a non-administrator account. But if I used pg_ctl to run postgres, it would not be as easy to monitor the process.

atrauzzi avatar Feb 17 '22 19:02 atrauzzi

Well, can you intercept the errors ? Maybe we can figure why - and possibly solve it.

ignatandrei avatar Feb 18 '22 08:02 ignatandrei

Not that I'm aware of, this is mainly because the error isn't originating from my own code. It's the postgres executable itself that has this limitation -- which is outside of my control.

If the .NET process APIs have the ability to run processes as a specific user other than the current one, then there might be something.

That being said, I certainly won't rule out any tricks or strategies. Just keep in mind that it's very difficult to work with process identity in Windows.

atrauzzi avatar Feb 18 '22 14:02 atrauzzi

Process. StartInfo. UserName

ignatandrei avatar Feb 18 '22 16:02 ignatandrei

I'll look into it :slightly_smiling_face:

atrauzzi avatar Feb 18 '22 17:02 atrauzzi