creack / pty

PTY interface for Go
https://pkg.go.dev/github.com/creack/pty?tab=doc
MIT License
1.68k stars 234 forks source link

how to start bash witch specific user? #191

Closed rickywei closed 6 months ago

rickywei commented 6 months ago

Hi there,

I want to start a pty and run bash with a specific user like root or testuser. I have try to use pty.StartWithAttrs(exec.Command("bash"), nil, attr), also, I change the Uid and Gid of Credential of attr. But the program gives none response. A bash can be run if I replace attr with nil.

Any advice?

Thanks in advance :)