DEV Community

Aashutosh Poudel
Aashutosh Poudel

Posted on

4 2

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

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay