Can I get shell access through SQL Server 2017 on Linux?
-
10-10-2020 - |
Question
There is a stored proc called xp_cmdshell
that is supposed to give you shell access on SQL Server, to the server. I am wondering if that works on Linux?
Solution
No sadly it doesn't, when I try EXEC xp_cmdshell 'dir *.exe';
I get,
Msg 15281, Level 16, State 1, Server x230, Procedure xp_cmdshell, Line 1 SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', search for 'xp_cmdshell' in SQL Server Books Online.
When I try to enable it with sp_configure 'xp_cmdshell', 1;
I get
Configuration option 'xp_cmdshell' changed from 0 to 1. Run the RECONFIGURE statement to install.
But, If I retry the EXEC xp_cmdshell
command above I get,
Msg 16202, Level 14, State 200, Server x230, Procedure xp_cmdshell, Line 1
Keyword or statement option 'xp_cmdshell' is not supported on the 'Linux' platform.
They are such kill joys.