Sudo for Windows

Almost everyone knows the program Sudo with the Linux operating system. This name stands for super user do. Unfortunately a similar program is missing with the Windows operating system. With Sudo you can start a program or open a document with administrator rights under your account which has only reduced rights. This is for example in the case of stubborn games, self-willed set-up-programs useful. But also as an alternative for the program runas it can perform good services.




Setup...
... is not necessary. In order always not to have to declare the complete path during the program call, it is reasonable to copy the program file Sudo.exe into the Windows folder.
<-- back

...and remove
also simply go. Deleting all files of Sudo, Sudo.exe, this readme.html and die source code folder. If you configured Sudo before, you call Sudo -c first, press the button Delete and close the dialog by press the button Cancel. This deletes the entries for the configuration from the registration database.
<-- back


Requirements
Sudo can be used only within a normal user account, that is one with reduced rights. It must exist also an administrator account with a password. In order to be able to use Sudo without restrictions, the own account must have also a password. If your account does not have any password, Sudo only with the -r switch can be used.
<-- back

Program options
Sudo -p<own password> -n<admin name> -a<admins password> -r -c -o <Program or Document> additional parameter
All options are indicated in lower case. All parameters do not have to be indicated. Missing parameters are asked by means of a dialog box.

-c: Configuring Sudo
-r: With this option Sudo act as runas
-o: New files own the user, explanation by Is this yours?

Example:
Own password: secret, admin account: admin, admins password: a123tx

    sudo -psecret -nadmin -aa123tx notepad abc.txt

Starts Notepad with the text file abc.txt with admin rights.

    Sudo notepad

A dialog box in which your password, the admin-account name and the password of the administrator are asked, appears.
<-- back

How Sudo works
The basic principle is simple:

There a small difficulty exists at the matter: Only administrators may carry out user administration. Therefore Sudo starts itself a second time under an admin-account. For this purpose the name of the admin and his password is necessary. So that out of this account a program can be started under your account, your user name and your password is necessary. Your user name is known to Sudo, not however your password.
For these reasons the above-mentioned specifications are necessary.
<-- back

Difference between Sudo and runas
With the windows program runas you can start a program with administrator rights. But this program runs then under the account of the administrator. That also means, however, that all changes and settings concern the account of the administrator and not about the own account. For example you can not store the energie options in a user account. The changing of the options in an admin-account does not keep on helping, however, either. In the case of games one would surely like to have the scores and so forth under his account and not under the admins account. With the switch -r behaves sudo, however, just the same as runas.
Tip: If the program to be started does not make any changes anyhow, the call is sudo -r is more favorable, because sudo then only once is started.
<-- back

Using Sudo meaningful
Now it is very annoying to have to declare always all parameters. Therefore Sudo can be configured. You start for this purpose Sudo -c.
A dialog box in which you can enter the necessary specifications appears. If you press the button Ok, these specifications are encoded by Windows in the registration database registered. You can call Sudo without switches now.
Not all fields of the dialog box do have to be filled. If for example you let the field emptily for the password of the admin, Sudo asks for the password of the admin.
<-- back


Sudo and Windows-Explorer
So that you also the Windows-Explorer with admin-rights can start, a change is necessary in the folder options:
- Every folder windows must start in an own process.
Without this change the Explorer starts only a copy of themselves, that means with old user rights.
You can create a link in the start menu or on the desktop with following content:
    sudo.exe explorer /e,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

and assign a hotkey to this link, for example AltGr+S. Whenever you press AltGr+S now, the Windows-Explorer starts just the same as if you press the hotkey Windows+E, however with administrator rights.
Note: All programs which you start with this Windows-Explorer have Admin-rights in the same way!
<-- back

Is this yours?
An experiment: Create a new text file with sudo notepad c:\x.txt. You store this file and close notepad. You open this file now again with notepad c:\x.txt -without sudo welfare noticed. You change some text and attempt to store it. Do not function! Discovery: Although you create this file, you are not owner of this file. Therefore you can not change the file. That is the default setting of sudo.
The case with the option -o is different: A call as sudo -o notepad c:\y.txt creates a text file those one owner you are. You can edit and save this file then also with the rights of a normal user account.
Caution: Never install programs with this option. Because also malware (Viruses and so forth) would have then execution rights onto the installed program files, drivers and so forth.
<-- back


Send to
If you create a link in the folder SendTo with Sudo as a destination, you can open every file with administrator rights.
Frequently it will suffice for this aim, when still add the switch -r with indicate, to use Sudo as an alternate for runas therefore.

Sudo as an alternative for runas
If you liked, you can extend the context menu for Exe-files. Import for this purpose the file sudo_shell.reg into the registration database of Windows.
The file has content mentioned below:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\exefile\shell\sudo]
@="Open with Sudo"
[HKEY_CLASSES_ROOT\exefile\shell\sudo\command]
@="sudo.exe -r \"%1\" %*"

There onto this key from a normal user account not may be written, you use SendTo, if you have create a link in the SendTo folder, or call sudo -r sudo_shell.reg. As an advantage opposite runas you do not need to declare the admin-account and the password of the admins anymore. Precondition is, however, that you configured sudo correspondingly.
<-- back

The Sourcecode
The program was build with the old CBuilder++ Version 4.0. No compiler-specific characteristics are used.
<-- back


Web: http://www.rt-sw.de/en/freeware/freeware.html
Mail:   mail@rt-sw.de

Copyright (c) 2006 by Reinhard Tchorz