RunAs also comes in a console application that runs in the command shell and offers a variety of additional options, including whether to load the profile, whether to use credentials only for network authentication. If you choose net only you continue to run as the same user locally, but whenever you authenticate on the network using Windows integrated authentication it uses the credentials you specify. You can also use this to authenticate using a smart card. So you can enter a smart card pin instead of a user name and password and it will get the user account information from the smart card instead.
An example command: runas /u:Administrator cmd.exe
Another option available to the command line is SaveCred. SaveCred allows you to save a password for that account and then reuse it later. This option is very misunderstood. A lot of people believe they can set up a shortcut that uses SaveCred so that they can allow a user to run just one specific program with admin credentials and only that program. The problem is that when SaveCred saves the credentials it saves it for whenever RunAs invokes that user account. So if you create a shortcut for a user that allows them to run one specific program and you are using SaveCred they could use RunAs/SaveCred to run something else also as admin. This could potentially create a security hole.
Personally, I don't use that option. I prefer entering the password whenever I need to run something as admin.
Elevating privileges for administrators
Step 1: RunAs dialog
Step 2: RunAs command line
Step 3: Differentiating security levels
Step 4: MakeMeAdmin
Step 5: Caveats
Step 6: Resources
|ABOUT THE AUTHOR:|
| Aaron Margosis is a Senior
Consultant with Microsoft Consulting Services, focusing on US Federal government customers. He
specializes in application development on Microsoft platforms and products with an emphasis on
application and platform security. Aaron has blogged extensively about how to run Windows as a
non-admin, and created the popular MakeMeAdmin and PrivBar utilities. Aaron holds Bachelors and
Masters Degrees from the University of Virginia, and calls Arlington, VA, home.
Copyright 2005 TechTarget
This was first published in April 2006