xp_cmdshell 활성화 쿼리

2021. 2. 19. 01:41IT/MS-SQL

반응형

구성 요소 'xp_cmdshell'이(가) SQL Server 보안 구성의 일부로 해제되었으므로 이 구성 요소의 프로시저 'sys.xp_cmdshell'에 대한 액세스가 차단되었습니다. 시스템 관리자는 sp_configure를 통해 'xp_cmdshell'을(를) 활성화할 수 있습니다. 'xp_cmdshell' 활성화에 대한 자세한 내용을 보려면 SQL Server 온라인 설명서에서 'xp_cmdshell'을(를) 검색하십시오.

SELECT * FROM sys.configurations WHERE name = 'xp_cmdshell'

실행시 value 값이 0 이면 비활성화 1 이면 활성화 상태이다.

 

#xp_cmdshell 활성화 쿼리

-- To allow advanced options to be changed.  
EXECUTE sp_configure 'show advanced options', 1;  
GO  
-- To update the currently configured value for advanced options.  
RECONFIGURE;  
GO  
-- To enable the feature.  
EXECUTE sp_configure 'xp_cmdshell', 1;  
GO  
-- To update the currently configured value for this feature.  
RECONFIGURE;  
GO  

 

#xp_cmdshell 비활성화 쿼리

EXEC sp_configure 'xp_cmdshell', 0
GO

RECONFIGURE
GO

EXEC sp_configure 'show advanced options', 0
GO

RECONFIGURE
GO

반응형