相当于 powershell 中的 su
假设我是 Windows7 机器的管理员。我希望能够在不知道密码的情况下以其他用户的身份运行命令。 这就是 Linux 上发生的情况。如果我是 root,我可以“su”到其他帐户,而无需提供任何密码,并以自己的名称运行命令。
Let's say I'm an administrator on a Windows7 box. I'd like to be able to run commands as other users without knowing their passwords.
This is what happens on linux. If I'm root, I can 'su' to other accounts without providing any password and run commands in their own name.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
su(替代用户或切换用户)允许更改与当前终端关联的帐户。 普通用户必须提供他想要更改的帐户的密码,超级用户(root)可以更改为他想要的任何ID,而无需提供密码。
sudo 以另一个用户的身份执行命令,但会遵守一组关于哪些用户可以以其他用户的身份执行哪些命令的约束(通常在名为
/etc/sudoers
的配置文件中,最好通过命令visudo
进行编辑)。与 su 不同,sudo 根据用户自己的密码而不是目标用户的密码对用户进行身份验证(以允许将特定命令委派给特定主机上的特定用户,而无需在他们之间共享密码,同时降低任何无人值守终端的风险)。在 Windows 上,runas.exe 允许用户使用与用户当前登录提供的权限不同的权限运行程序。但为此,您必须提供凭据。 Windows 安全性不允许管理员在没有凭据的情况下以其他用户身份执行操作。管理员可以做他们想做的事,但不能在没有控制的情况下做他们想做的事(自由裁量权)
现在一旦有人说,在 Windows 上,管理员可以获取并授予资源所有权,然后做他想做的事,但它会被记录下来。
su (substitute user or switch user) allows changing the account associated with the current terminal. Where Normal user have to give password of the account he wants to change to, super user (root) can change to any ID he wants without giving password.
sudo executes a command as another user but observes a set of constraints about which users can execute which commands as which other users (generally in a configuration file named
/etc/sudoers
, best editable by the commandvisudo
). Unlike su, sudo authenticates users against their own password rather than that of the target user (to allow the delegation of specific commands to specific users on specific hosts without sharing passwords among them and while mitigating the risk of any unattended terminals).On windows runas.exe allows a user to run a programs with different permissions than the user's current logon provides. But for this you have to provide credentials. Windows security does not allow an administrator to execute as another user without his credentials. Administrators can do what they want but not under certains limits without control(discretionary power)
Now once it's said, on Windows an administrator can take and give ownership of ressources and then do what he wants, but it's logged.