# Runas

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Runas
> Markdown URL: https://mediated.wiki/source/Runas.md
> Source: https://en.wikipedia.org/wiki/Runas
> Source revision: 1232571159
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Command on Windows to run a program as another user}}
{{lowercase title}}
{{Infobox software 
| name                   = runas
| logo                   = 
| screenshot             = 
| screenshot size        = 
| caption                = 
| developer              = [Microsoft](/source/Microsoft)
| released               = {{Start date and age|2000|02|17}}
| latest release version = 
| latest release date    = 
| operating system       = [Microsoft Windows](/source/Microsoft_Windows)
| genre                  = [Command](/source/Command_(computing))
| license                = [Proprietary](/source/Proprietary_software) [commercial software](/source/commercial_software)
| website                = {{URL|1=https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc771525(v=ws.11)}}
}}
In [computing](/source/computing), '''<code>runas</code>''' (a compound word, from “run as”) is a [command](/source/command_(computing)) in the [Microsoft Windows](/source/Microsoft_Windows) line of [operating system](/source/operating_system)s that allows a user to run specific tools and programs under a different [username](/source/User_(computing)) to the one that was used to [logon](/source/Logging_(computer_security)) to a computer interactively.<ref>{{Cite web |date=2009-09-11 |title=Runas |url=https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490994(v=technet.10) |access-date=2024-07-04 |website=learn.microsoft.com |language=en-us}}</ref> It is similar to the [Unix](/source/Unix) commands <code>[sudo](/source/sudo)</code> and <code>[su](/source/Su_(Unix))</code>, but the Unix commands generally require prior configuration by the system administrator to work for a particular user and/or command.

==Microsoft Windows==
The <code>runas</code> command was introduced with the [Windows 2000](/source/Windows_2000) operating system.<ref>{{Cite web |title=MS-DOS and Windows command line runas command |url=https://www.computerhope.com/runas.htm |access-date=2024-07-04 |website=computerhope.com}}</ref> Any application can use this API to create a [process](/source/process_(computing)) with alternate credentials, for example, [Windows Explorer](/source/Windows_Explorer) in [Windows 7](/source/Windows_7) allows an application to be started under a different account if the shift key is held while right clicking its [icon](/source/Computer_icon). The program has the ability to cache verified credentials so that the user only ever has to enter them once.

===Syntax===
The command-[syntax](/source/syntax) is:<ref>{{Cite web |title=Runas - Run under a different user account - Windows CMD - SS64.com |url=https://ss64.com/nt/runas.html |access-date=2024-07-04 |website=ss64.com}}</ref>
<syntaxhighlight lang="text">
runas [{/profile | /noprofile}] [/env] [/netonly] [/smartcard] [/showtrustlevels] [/trustlevel:<TrustLevel>] [/savecred] /user:<UserAccountName> program
</syntaxhighlight>

====Parameters====
This section is paraphrased from the <code>runas /?</code> command.
*<code>/noprofile</code>: Speeds up the loading of the application by skipping the loading of the user's profile. ''Note that this might not speed up every application.''
*<code>/profile</code>: Do not skip loading the user's profile. ''This is the default setting.''
*<code>/env</code>: Use the actual environment, not the user's.
*<code>/netonly</code>: Specifies that the given credentials are to be used for Remote access only.
*<code>/savecred</code>: Credentials saved by the previous user. ''This setting is not available on Windows 7 Home or Windows 7 Starter Edition. This setting is left out from Windows XP Home Edition as well.''
*<code>/smartcard</code>: Specifies that the credentials will be supplied from a smartcard.
*<code>/user</code>: Format is either <code>USER@DOMAIN</code> or <code>DOMAIN\USER</code>.
*<code>/showtrustlevels</code>: Shows help (list of usable trust level parameters) for the /trustlevel switch.
*<code>/trustlevel</code>: One of the trust levels listed by the /showtrustlevels switch.
*<code>program</code>: Command line for the executable file. ''See examples below.''

Note: Only type in the user's password, when the system asks for it.

Note: The <code>/profile</code> switch is not compatible with the <code>/netonly</code> switch.

Note: The <code>/savecred</code> and the <code>/smartcard</code> switches may not be used together.

===Examples===
<syntaxhighlight lang="dosbatch">
runas /noprofile /user:machine\administrator cmd
runas /profile /env /user:domain\admin "mmc %windir%\system32\dsa.msc"
runas /user:user@domain.example.org "notepad C:\filename.txt"
runas /user:administrator /savecred "shutdown /i"
</syntaxhighlight>

==Inferno==
The command is also included in the [Inferno](/source/Inferno_(operating_system)) operating system.<ref>{{Cite web|url=http://inferno-os.org/inferno/man/1/runas.html|title = Inferno's RUNAS(1 )}}</ref>

===Syntax===
<code>runas</code> writes the <code>user</code> to <code>/dev/user</code> and invokes <code>cmd</code> with the given [arguments](/source/Command-line_argument).
<syntaxhighlight lang="text">
runas user cmd [arg...]
</syntaxhighlight>

Note: The command is only invoked if setting of the username succeeds.

==See also==
*[Comparison of privilege authorization features](/source/Comparison_of_privilege_authorization_features)
** [sudo](/source/sudo)
** [doas](/source/doas)
*[Principle of least privilege](/source/Principle_of_least_privilege)
*[User Account Control](/source/User_Account_Control), which disables the Administrator SID for the desktop, allowing it to re-enabled by exception.

==References==
{{Reflist}}

==Further reading==
*{{Cite book|first=Æleen|last=Frisch|year=2001|title=Windows 2000 Commands Pocket Reference|publisher=[O'Reilly](/source/O'Reilly_Media)|isbn=978-0-596-00148-3}}
*{{Cite book|first=William R.|last=Stanek|year=2008|title=Windows Command-Line Administrator's Pocket Consultant, 2nd Edition|publisher=[Microsoft Press](/source/Microsoft_Press)|isbn=978-0735622623}}

==External links==
{{Wikibooks|Guide to Windows Commands}}
*[https://technet.microsoft.com/en-us/sysinternals/cc300361.aspx Sysinternals ShellRunas]
*[https://runas.eu Alternative Runas tools]
*{{man|1|runas|Inferno}}

{{Windows commands}}

Category:Operating system security
Category:Microcomputer software
Category:Computer security software
Category:Windows administration
Category:Inferno (operating system) commands

---
Adapted from the Wikipedia article [Runas](https://en.wikipedia.org/wiki/Runas) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Runas?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
