R Script permissions error I executed this to check to see if I have write permissions on a folder and it fails (returns -1). I am a system admin and SQL admin.  I have full access to this directory but the R Script says I do not.  If I change the mode of the script to check for read or execute permissions, it succeeds (returns 0).  What else can I check to fix this?

EXECUTE sp_execute_external_script
       @language = N'R'
      ,@script = N'OutputDataSet &lt;- data.frame(file.access("C:/Program Files/Microsoft SQL Server/MSSQL13.MSSQLSERVER/R_SERVICES/library/", 2));'
WITH RESULT SETS (([DefaultLibraryName] VARCHAR(MAX) NOT NULL));
GO
I think you 'might' need to grant the proper authority on that folder to the Windows group SQLRUserGroup.  

I have a test SQL Server instance where R-Services is installed.  I took your script and changed the directory to be C:/Scripts (just as a test).

EXECUTE sp_execute_external_script
       @language = N'R'
      ,@script = N'OutputDataSet &lt;- data.frame(file.access("C:/scripts/", 2));'
WITH RESULT SETS (([DefaultLibraryName] VARCHAR(MAX) NOT NULL));
GO


I got the same -1 return code as you.

I then granted FULL access against C:/Scripts to the Windows group SQLRUserGroup and ran the same script code.  It executed successfully with a zero (0) being returned.