|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Yesterday @ 8:05 AM
Points: 437,
Visits: 853
|
|
I am logged in as an administrator and each time i run the following query
exec master.dbo.xp_cmdshell 'dir c:\users\administrator.mydomainname\desktop\resumes\*.*'
I get an 'Access is denied' error!
This worked fine on my other server, what am i missing?
Thanks
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 5:22 AM
Points: 1,123,
Visits: 4,423
|
|
isuckatsql (3/23/2010) I am logged in as an administrator and each time i run the following query
exec master.dbo.xp_cmdshell 'dir c:\users\administrator.mydomainname\desktop\resumes\*.*'
I get an 'Access is denied' error!
This worked fine on my other server, what am i missing?
Thanks
Are the account has sysadmin privilege ?
Muthukkumaran Kaliyamoorthy
Helping SQL DBAs and Developers >>>SqlserverBlogForum
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 5:22 AM
Points: 1,123,
Visits: 4,423
|
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Saturday, May 11, 2013 8:56 PM
Points: 754,
Visits: 1,891
|
|
Check the SQL service account permissions on the box that is working, versus the box that is not working?
http://msdn.microsoft.com/en-us/library/aa260689(SQL.80).aspx
When you grant execute permissions to users, the users can execute any operating-system command at the Microsoft Windows NT® command shell that the account running Microsoft SQL Server™ has the needed privileges to execute.
-------------------------------------------------------------- Shawn Melton @wshawnmelton
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Yesterday @ 8:39 PM
Points: 11,638,
Visits: 27,713
|
|
this is a common security issue. The problem is that when you access any resource OUTSIDE of SQL server, like network shares, local hard drives,sp_OA type functions etc, it doesn't matter what YOUR credentials are, like Domain Admin,Local Admin etc, because SQL will not carry those credentials to the "outside of SQL" security context.
SQL Server uses the account it starts with to try and access the resource:

That account is often an account which has never logged into the domain, and was never assigned permissions to get to the local disk or network share. As a result, you usually need to create a domain account in Active Directory, specifically grant it share access if it doesn't inherit it from Domain\Users or Domain\AuthenticatedUsers and change the account SQL Server starts with to that account.
Once that is done, and you stop and start the SQL service to make it use that account instead of old running values, your linked server/xp_cmdshell would work.
you can prove this is the issue by simply putting in your credentials, with your domain account and password, and confirm the linked server works when SQL is run your credentials, so you'd know you need a domain account to access the resource.

Lowell
--There is no spoon, and there's no default ORDER BY in sql server either. Actually, Common Sense is so rare, it should be considered a Superpower. --my son
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Yesterday @ 8:05 AM
Points: 437,
Visits: 853
|
|
I am logged into SSMS as 'sa'.
The exact error message is 'Access is Denied'.
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Yesterday @ 8:05 AM
Points: 437,
Visits: 853
|
|
Lowell, That work great! Thanks.
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Yesterday @ 8:39 PM
Points: 11,638,
Visits: 27,713
|
|
glad i could help!
Lowell
--There is no spoon, and there's no default ORDER BY in sql server either. Actually, Common Sense is so rare, it should be considered a Superpower. --my son
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, November 15, 2012 6:42 AM
Points: 4,
Visits: 4
|
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Yesterday @ 8:39 PM
Points: 11,638,
Visits: 27,713
|
|
ntingab (11/15/2012) Thank you Lowell glad this post helped you, ntingab!
Lowell
--There is no spoon, and there's no default ORDER BY in sql server either. Actually, Common Sense is so rare, it should be considered a Superpower. --my son
|
|
|
|