DEV Community

Aashutosh Poudel
Aashutosh Poudel

Posted on

Adding sudo to windows

It is sometimes annoying to open a terminal in windows with elevated privileges as you have to rely on some form of GUI to select the option Run as Admin. In Linux we can just open the terminal with a hotkey and then get root access straight with sudo from the same terminal.

In windows, there's a tool called gsudo that allows us to turn our normal cmd or powershell terminal into an administrative terminal just like sudo does in Linux. So, we just prepend whatever command we like to run with gsudo and it will show us a User Access Control(UAC) pop-up where we can insert our username and password. Usage

To make gsudo work more like sudo in linux, we can enable credentials cache that will show less UAC popups just like in Linux where sudo remembers your password for 15 minutes by default.

gsudo config CacheMode Auto
Enter fullscreen mode Exit fullscreen mode

Latest comments (0)