Runas命令:能让域用户普通User用户以管理员身份运行指定程序

Runas 命令:能让域⽤户普通User ⽤户以管理员⾝份运⾏指定程序
在win2k 中,开始→程序→附件 ,到计算器,按住shift 键,点右键,选择“运⾏⽅式 ...”,这时候,会弹出对话框,询问你要使⽤哪个⽤户⾝份来运⾏该程序 。
不知道⼤家是否使⽤过win2k 的这个功能,如果⼤家是使⽤win2k 的英⽂版本的话,在按住shift 后选择的就不是“运⾏⽅式 ...”⽽是“”,也就是今天要讲的这个命令。
在cmd 中输⼊runas ,会得到帮助,今天,我们只将它最简单的⽤法,就是怎么样使⽤这个命令来以另外⼀个⽤户⾝份运⾏⼀个程序。
其实,命令⾮常简单:
runas /user:user_
user_name 是要使⽤哪个⽤户运⾏该程序就写上哪个⽤户名, 是程序名,如果 不在system32⽬录下的话,需要指明具体路径。
为了证明这个过程,做⼀个实验,那就是使⽤guest 帐号来运⾏at 命令,查看当前的计划任务清单,⼤家都知道,guest 默认情况下是没有此权限的,因此,只要这个命令真的起作⽤的话,会出现“拒绝访问”的字样,在这⾥,我们使⽤这个命令:
工业盐水runas /user:guest " cmd/"
< 是调⽤cmd 这个程序,⽽cmd/k 则是指cmd 命令后跟/k 参数,⽬的是为了是当前的执⾏结果的屏幕保留 。
(注意:这⾥由于命令过长,⽽且中间有空格,所以⽤引号引起来,如果只有⼀个命令,例如at.exe 的话,那么就不需要有引号了)
例:
电磁悬浮(1)runas /user:administrator "C:Program "
(2)输⼊密码:(输⼊时密码会看不到)
(3)这样就可以⽤“administrator"⽤户权限来启动那个程序了,通常我们可以使⽤它来执⾏安装程序,即可做到不⽤切换⽤户来安装“
钟罩阀
由于运⾏的程序是在⼀个新窗⼝中打开,⽽不是在原来的cmd 窗⼝中打开,所以,如果我不使⽤ cmd/k 这个参数的话,窗⼝会⼀闪⽽过,看不到效果。
运⾏完这个命令后,会要求guest 的密码,填上,回车,等⼀会,⼀会就会出现⼀个cmd 窗⼝,⾥⾯写着“拒绝访问”,⽽且,在cmd 窗⼝上沿还有“(运⾏为guest)”的字样。
这个⼯具还可以在域中使⽤,⽽且还可以加上个⼈配置⽂件,实在是很爽 ~~~RUNAS ⽤法:RUNAS [/profile] [/env] [/netonly] /user: program
/profile 如果需要加载⽤户的配置⽂件
/env 要使⽤当前环境,⽽不是⽤户的环境。
/netonly 只在指定的凭据限于远程访问的情况下才使⽤
/user 应使⽤ USER@DOMAIN 或 DOMAINUSER 形式
program EXE. 的命令⾏。参阅下⾯的例⼦
例如:
runas /profile /user:mymachineadministrator cmd
runas /profile /env /user:mydomainadmin "mmc %windir%system32dsa.msc"
杂物门
runas /env /user:user@domain.microsoft "notepad """
注意: 只有在被提⽰时才输⼊⽤户的密码。
注意: USER@DOMAIN 与 /netonly 不兼容。
但由于RUNAS 每次都要⾃⼰输⼊密码,很是⿇烦,我们也可以改⽤其它⽅法:
⾃动输⼊RUNAS 密码的⽅法
以⾮管理员⽤户登录时,如果要⽤管理员权限运⾏程序的话,需要⽤到 runas 命令,在使⽤脚本运⾏时,⽆法简单的利⽤管道来输⼊密码,有以下⽅法可免除每次需要输⼊密码的⿇烦。
1、使⽤系统⾃带的 runas /savecred 选项,第⼀次输⼊密码后,会保存凭据。
特点:⽆法限制能够运⾏的命令,安全性差。
2、使⽤ sanur ,sanur 是⼀个⼩程序,能以管道的⽅法将密码或者⽂件中的内容传递给 runas 程序。
runas | sanur password runas | sanur /i [drive:][path]filename 特点:密码明⽂保存。About Sanur
Sanur is a tiny Win32 console utility that pipes a password into the Windows 2000/XP/2003 Runas utility, thereby making Runas scriptable.
Licencing
Sanur is freeware. There is no fee for personal or corporate use. For more details see file included in sanur.zip.
Usage
Pipe your normal Runas commandline into Sanur and specify the password on Sanurs commandline or use the /i switch to have Sanur read the password from a file:-
RUNAS | SANUR password
微型水轮发电机
RUNAS | SANUR /i [drive:][path]filename
In otherwords, just add | SANUR password to the end of your working Runas command.
Examples
Pipe the password pa55w0rd into Runas:-
runas /u: | sanur pa55w0rd
pvc文件袋Pipe the password from the file into Runas:-
runas /u: | sanur /
Same as above but any Runas errors, such as a logon failure, will be displayed:-
runas /u: >&2 | sanur /
Support
As of 2005-01-11 Sanur is no longer supported. If you are having problems getting Sanur to work please read the troubleshooting AND the FAQ pages, or seek an alternative solution. Please dont send me any emails relating to Sanur.
例:runas /u: | sanur /i 123.jpg 我们使⽤guest ⽤户,密码正在 ⾥⾯,由于密码是⽤明⽂存贮,不安全,所以将.txt 改为了.jpg,这样就不能直接查看
了,并把它设了系统隐藏。

本文发布于:2024-09-22 15:37:48,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/1/251238.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:命令   程序   密码
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议