[英]Possible to log into another Windows account using “SQL Server Authentication”?
If I want to log into a SQL Server instance using another Windows account can I do this by simply selecting "SQL Server Authentication" as my authentication mode and entering the DOMAIN/username
and password
for the account I want to use? 如果我想使用其他Windows帐户登录SQL Server实例,我可以通过选择“SQL Server身份验证”作为我的身份验证模式并输入我想要使用的帐户的
DOMAIN/username
和password
来执行此操作吗?
Are there any special settings that I need to set in order to get this to work? 我需要设置任何特殊设置才能使其正常工作吗?
No. 'SQL Server Authentication' works only with SQL Server logins, it won't work with a NT login. 不。“SQL Server身份验证”仅适用于SQL Server登录,它不适用于NT登录。 To log in as another credential have the process run as the credential you desire to run as.
要以另一个凭据登录,该进程将作为您希望运行的凭据运行。 Use
runas
, most likely you want to run SSMS like this: 使用
runas
,很可能你想运行SSMS,如下所示:
runas /netonly /user:domain\user "c:\program files\...\ssms.exe"
By specifying the /netonly
argument your SSMS will run with the desired NT credential only for remote hosts, locally will have your local credentials. 通过指定
/netonly
参数,您的SSMS将仅为远程主机运行所需的NT凭据,本地将具有您的本地凭据。 This not only preserves your SSMS environment (last used files, options etc) and doesn't require domain\\user\u003c/code> to have local priviledges, but, more importantly, it works even for a completely unrelated domain .
这不仅保留了您的SSMS环境(上次使用的文件,选项等),也不需要
domain\\user\u003c/code>拥有本地特权,但更重要的是,它甚至可以用于完全不相关的域 。
That is if you machine is in domain
foo
(or not even joined to the domain) and the desired runas is in domain bar
, the runas /netonly /user:bar\\user ...
will run just fine. 也就是说如果你的机器在域
foo
(或者甚至没有加入域)并且所需的runas在域bar
,那么runas /netonly /user:bar\\user ...
就可以运行了。
The
/netonly
trick works only if the SQL server host you are connecting to is remote (not on the same machine). 只有当您连接的SQL服务器主机是远程的(不在同一台机器上)时,
/netonly
技巧才有效。 If is local, then your runas
must be locally using the desired credential, so remove the /netonly
argument. 如果是本地的,那么您的
runas
必须在本地使用所需的凭证,因此请删除/netonly
参数。
If you have Windows 7, you can add credentials for other domains via Control Panel > Administrative Tools > Credential Manager. 如果您使用的是Windows 7,则可以通过“控制面板”>“管理工具”>“凭据管理器”为其他域添加凭据。 Map your credentials to each server you want to log into.
将凭据映射到要登录的每个服务器。
Then, log into additional machines using Windows Authentication. 然后,使用Windows身份验证登录其他计算机。 I think there is a caveat - it will try to log you in to the server using your current domain/username.
我认为有一个警告 - 它会尝试使用您当前的域/用户名登录服务器。 IF that is rejected, it will lookup any entries you have for that server in Credential Manager, and if those are valid, you will be logged in.
如果被拒绝,它将在Credential Manager中查找您为该服务器提供的任何条目,如果这些条目有效,您将登录。
If I understand the question correctly, the solution it just ship + Right click on your SSMS, that will give you "connect as different user" option and that where you want to put your windows authentication. 如果我正确理解了这个问题,那么它只是发布的解决方案+右键单击您的SSMS,这将为您提供“以不同用户身份连接”选项以及您想要进行Windows身份验证的位置。 Domain\\User and password.
域\\用户和密码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.