gerardog / gsudo

Sudo for Windows
https://gerardog.github.io/gsudo
MIT License
5.07k stars 136 forks source link

Is there any way to use gsudo to replace the sudo command of win11? After installing gsudo in win11 with built-in sudo, sudo can no longer be used, only gsudo can be used #361

Closed tianlongJ closed 3 weeks ago

gerardog commented 3 weeks ago

Since you closed the issue, I imagine you have found the answer.

For anyone else:

https://gerardog.github.io/gsudo/docs/gsudo-vs-sudo#what-if-i-install-both

With the release of gsudo v2.5.0, a new configuration setting called PathPrecedence has been added. When set to true, it ensures gsudo appears first in the PATH variable, making the sudo keyword start gsudo instead of Microsoft's sudo. To activate, call 'gsudo config PathPrecedence true' and restart all consoles to apply the change. Setting it back to false will revert to the normal behavior.

tianlongJ commented 3 weeks ago

Since you closed the issue, I imagine you have found the answer.

For anyone else:

https://gerardog.github.io/gsudo/docs/gsudo-vs-sudo#what-if-i-install-both

With the release of gsudo v2.5.0, a new configuration setting called PathPrecedence has been added. When set to true, it ensures gsudo appears first in the PATH variable, making the sudo keyword start gsudo instead of Microsoft's sudo. To activate, call 'gsudo config PathPrecedence true' and restart all consoles to apply the change. Setting it back to false will revert to the normal behavior.

Sorry to bother you, I tried the command "gsudo config PathPrecedence true" but it had no effect image

tianlongJ commented 3 weeks ago

Since you closed the issue, I imagine you have found the answer. For anyone else: https://gerardog.github.io/gsudo/docs/gsudo-vs-sudo#what-if-i-install-both With the release of gsudo v2.5.0, a new configuration setting called PathPrecedence has been added. When set to true, it ensures gsudo appears first in the PATH variable, making the sudo keyword start gsudo instead of Microsoft's sudo. To activate, call 'gsudo config PathPrecedence true' and restart all consoles to apply the change. Setting it back to false will revert to the normal behavior.

Sorry to bother you, I tried the command "gsudo config PathPrecedence true" but it had no effect image

I solved this problem because I installed it using scoop, and the sudo command address was not in the installation directory, but in the shims directory defined by scoop image