Avatar of Matt Bartlett
Matt Bartlett
Flag for United Kingdom of Great Britain and Northern Ireland asked on

SQL User cannot access file system with functions or queries

I have a user that is trying to run an SQL function that includes:
   
xp_dirtree @directory, 10, 1

Open in new window


in SQLServer 2008.

The function works fine on other accounts that people use but on this users account it doesn't seem to allow their SQL user account to access the file system.

I cannot work out if the access to the file structure is a setting within SSMS on the user account there or if it something within the file permissions on the file server or something within the settings of the users domain account.

The Set-up is SQL Server 2008.
File Server is Windows Server 2012 R2
SQL Server is Windows Server 2008 R2
The User has "Owner" level permission on the database where the function and output tables are stored.
The User has "modify" permissions

Any help would be great.

Kind Regards

Matt
Microsoft SQL ServerSQL

Avatar of undefined
Last Comment
Matt Bartlett

8/22/2022 - Mon
Daniel_PL

This command uses SQL Server service account permissions. Inside SQL Server you grant permissions to this function, however, outside SQL Server its service account gets data for you.
Don't forget it's an undocumented procedure.
Matt Bartlett

ASKER
So is it possible to set this user to be able to run this function?
Whether that be a work around or change to the function to run it through the service account or some settings that need to be changed, we just need this user account to be able to run the function.

Kind regards

Matt
ASKER CERTIFIED SOLUTION
Daniel_PL

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Matt Bartlett

ASKER
Thanks Daniel.

I can start working on this with the links you provided. We have a new starter that doesn't need sysadmin level rights and this work around should allow these functions to continue as normal.

Kind regards

Matt
Your help has saved me hundreds of hours of internet surfing.
fblack61