zalando / go-keyring

Cross-platform keyring interface for Go
MIT License
811 stars 82 forks source link

[Linux/Ubuntu]When running compiled binary with sudo an error shows up #62

Closed nikolalukovic closed 2 years ago

nikolalukovic commented 2 years ago

This is the error I get when I try to run the binary with sudo

failed to unlock correct collection '/org/freedesktop/secrets/aliases/default'

Now, I don't know enough about keyring to know where the issue exactly is. Is it the issue with gnome-keyring or this lib? Also, is there anything I can do to mitigate this problem? The reason I'm running the binary with sudo is since it's being used to connect to vpn, and I can't to that without sudo. I wanted to keep the username/password pair in keyring for future vpn connections. Is that even possible?

Ubuntu: 21.04 Gnome: 3.38.5

szuecs commented 2 years ago

Hi @nikolalukovic ! I would assume that you have to first unlock the keyring for root in your case.

nikolalukovic commented 2 years ago

How to do that? When I run my binary with sudo I don't even get the prompt to unlock it, this error pops up immediately. And I apologize if I'm asking stupid questions, I just don't have enough experience in this field.

szuecs commented 2 years ago

@nikolalukovic I don't know

nikolalukovic commented 2 years ago

For anyone who's as dumb as I am. The problem was that root user didn't have a keyring at all. So I ran Seahorse as sudo and created a keyring called login. That's it. Now everything works as it should.