Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
$ go version
go version go1.13.4 windows/amd64
Try to launch a process as a different user. Found syscall.Credential can be supplied as a SysProcAttr to exec.Cmd.
Ability to launch process as different user, on all supported OSes.
syscall.Credential only supports UID/GID and only works on Unix-like systems. There's no option for Windows (based on either CreateProcessWithLogonW call, or LogonUser/CreateProcessAsUserW pair call).
The text was updated successfully, but these errors were encountered:
On Windows, syscall.SysProcAttr is this: https://golang.org/pkg/syscall/?GOOS=windows#SysProcAttr
I think you can load the appropriate DLL for LogonUser (see https://godoc.org/golang.org/x/sys/windows#NewLazyDLL), call the function, which grants a syscall.Token, then use it with SysProcAttr.
Sorry, something went wrong.
Thanks @acln0, I think you're right.
I believe this is a duplicate of #21105. I think the associated CL, golang.org/cl/75253 includes an example of this. I'll close this as a duplicate, but please let me know if I am mistaken.
No branches or pull requests