Runas使用密码的几种方法

简介:

        在企业管理中许多用户都没有管理员权限,这样如果我们需要运行某个程序时,往往需要管理员操作,这样对于一些外地用户或者用户数量大时管理员则显得非常忙碌,这样我们通常是使用Runas命令来解决这个问题,Runas命令的写法是

RUNAS [/profile] [/env] [/netonly] /user:<UserName> program

这里有个问题,在运行的时候,需要手动输入用户名密码,比较麻烦,也不安全。

下面介绍几种方法可以自动记录密码的方法

1、使用系统自带的 runas /savecred 选项,第一次输入密码后,会保存凭据。
特点:无法限制能够运行的命令,安全性差。

2
、使用 sanursanur 是一个小程序,能以管道的方法将密码或者文件中的内容传递给 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 the 'readme.txt' file included in sanur.zip.

Usage
Pipe your normal Runas commandline into Sanur and specify the password on Sanur's commandline or use the /i switch to have Sanur read the password from a file:-

RUNAS <options> | SANUR password
RUNAS <options> | 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:domain\username program.exe | sanur pa55w0rd

Pipe the password from the file named password.txt into Runas:-

runas /u:domain\username program.exe | sanur /i password.txt

Same as above but any Runas errors, such as a logon failure, will be displayed:-

runas /u:domain\username program.exe >&2 | sanur /i password.txt

Support
As of 2005-01-11 Sanur is no longer supported. If you are having problems getting Sanur to work please read the 
troubleshootingAND the FAQ pages, or seek an alternative solution. Please don't send me any emails relating to Sanur.

例:runas /u:domain\guest notepad.exe | sanur /i 123.jpg 我们使用guest用户,密码正在123.txt里面,由于密码是用明文存贮,不安全,所以将.txt改为了.jpg,这样就不能直接查看了,并把它设了系统隐藏。


----------------------------------
相关页面:
http://www.commandline.co.uk/sanur_unsupported/index.html

3
、使用 lsrunas,功能类似 sanur,不过它无需运行 runas,自带完整的参数来执行。
特点:密码明文保存。
相关页面:
http://www.moernaut.com/default.aspx?item=lsrunas

4
、使用 lsrunaselsrunas 的加强版本,可以使用加密的密码。自带一个小软件 LSencrypt 用来生成加密的字串。
用法:
lsrunase /user:administrator /password:41BngA== /domain: /command:notepad.exe /runpath:c:\
所有的参数必须齐全,其中:
user 
为运行的账号
password 
为密码加密后的字串
domain 
为机器名或域名,也可留空代表本机
command 
为要运行的程序名,如果携带参数需要在命令的首尾加引号
runpath 
为程序启动的路径
特点:可以较完美的替代 runas,并避免直接将密码明文保存在脚本中。
相关页面:
http://www.moernaut.com/default.aspx?item=lsrunase

5
、使用 cpaucpau 也是一个替代 runas 的程序,并且功能强大,可以使用加密的密码。
用法:
cpau -u administrator -p password -ex notepad -file start_notepad.txt -enc
cpau -file start_notepad.txt -dec
以上命令可以先将要执行的指令加密保存为一个文件,执行时载入此文件。
特点:可以保护执行的脚本及命令不被他人查看,但在使用网络路径时存在一些问题。
相关页面:
http://www.joeware.net/win/free/tools/cpau.htm

6
、使用 autoitautoit 是一个脚本自动化执行的工具,可以完成很多自动化的任务,并且可以将脚本编译成 exe 文件来直接运行,从而达到了隐藏密码信息的目的。
特点:功能强大,但操作复杂。
相关页面:
http://www.autoitscript.com/autoit3/

还有其他一些工具能够完成类似的操作。

runasspc

参考页面:

http://www.commandline.co.uk/sanur/

lsrunas 不能运行msi文件。 如果自己可以手工收入密码,的话,可以把msi写进bat文件中,然后bat可以使用管理员方式运行。但是如果要自动以管理员方式运行,自动输入密码,则必须使用autoit了。










本文转自 chengchow 51CTO博客,原文链接:http://blog.51cto.com/chengchow/812744,如需转载请自行联系原作者
目录
相关文章
|
11月前
|
数据安全/隐私保护 计算机视觉
QWE密码
QWE密码
256 0
|
11月前
|
Linux 数据安全/隐私保护
ADFGVX密码
ADFGVX密码
76 0
|
11月前
|
Linux 数据安全/隐私保护 知识图谱
ADFGX密码
ADFGX密码
172 0
|
11月前
|
机器学习/深度学习 Linux 数据安全/隐私保护
维吉尼亚密码(Vigenere)
维吉尼亚密码(Vigenere)
151 0
|
11月前
|
Linux 数据安全/隐私保护
普莱费尔密码(playfair)
普莱费尔密码(playfair)
113 0
|
安全 算法 数据安全/隐私保护
C/C++编程题之简单密码
密码是我们生活中非常重要的东东,我们的那么一点不能说的秘密就全靠它了。哇哈哈. 接下来渊子要在密码之上再加一套密码,虽然简单但也安全。
|
应用服务中间件 数据安全/隐私保护 nginx
密码访问
密码访问
106 0
|
前端开发 JavaScript 数据安全/隐私保护
Validform验证修改密码
前端页面、验证原密码后台代码、提交表单js代码、提交表单后台代码。
129 0
|
前端开发 PHP 数据安全/隐私保护
laravle对密码验证,密码和重复密码
laravle对密码验证,密码和重复密码
388 0
laravle对密码验证,密码和重复密码
|
数据安全/隐私保护
用户名和密码校验程序
name = input('请输入用户名:') password = input('请输入密码:') if 6
1033 0