Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access denied for enabled xp_cmdshell for the admin user

I'm using xp_cmdshell within a database trigger to launch a exe file.

xp_cmdshell is enabled(it can execute simple cmd command like 'echo'). But when I try to launch the exe through xp_cmdshell, the access is denied.

I am the database administrator. And I can launch the exe through cmd directly. Anyone know why I get denied and how to fix it?

like image 564
Joshua H. Avatar asked May 30 '12 18:05

Joshua H.


2 Answers

Use xp_cmdshell to run "whoami", then check effective permissions for the stated user on the exe and any resources it accesses. Odds are that an account like localsystem is being used to run processes via xp_cmdshell.

EXEC xp_cmdshell 'whoami'
like image 153
Peter Wishart Avatar answered Nov 02 '22 14:11

Peter Wishart


Likely insufficient NTFS permissions. Make sure the 'user account' that the SQL Server is running as, has permission (Read+Execute) to the *.EXE (and any dependent files)

like image 34
JMC Avatar answered Nov 02 '22 15:11

JMC