sudo for windows. Sort-of

Windows (XP) has a pretty basic users system, and switching between users is pretty convoluted. Also, msi binaries don’t have the Run As... option in their right click menu by default. There’re two ways of doing it:

First, the runas command, which is sort-of sudo for Win32. There’s no /etc/sudoers, it uses the AD/NTFS ACLs. Really, it’s su -c Usage:

runas /user: 

Both should be in quotemarks if there are spaces, username should specify domain. For example, my favourite is:

runas /noprofile /user:"avi greenbury@sgl" cmd

Which skips loading my profile (think sudo -m), and opens up a dos prompt with my rights. It opens a command window to enter your password, there is no way of supplying it with the command.

The above generally works, but a more persistent method is to start your own shell.
<ctrl><alt><del> to bring up the task manager, kill explorer.exe, click New Task..., browse to c:/windows/ and find explorer.exe. Right-click, choose Run As... and enter the admin credentials.


Posted

in

by

Tags: