通过sp_execute_external_script执行R代码时访问网络共享所需的权限 [英] Permissions required to access network share when executing R code via sp_execute_external_script

查看:151
本文介绍了通过sp_execute_external_script执行R代码时访问网络共享所需的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


你好

Hi there


我们正在使用带有R服务的SQL Server 2016(在数据库中),并且在尝试从我们网络上的某个位置加载R脚本时遇到问题。例如:source("\\ MyServer \ MyRDirectory \HelloWorld.R")。

We are using SQL Server 2016 with R Services (In Database) and are having issues trying to load an R script from a location on our network. For example: source("\\MyServer\MyRDirectory\HelloWorld.R").


我们收到此错误:  无法打开文件'V:\ HelloWorld.R':没有这样的文件或目录

We get this error:  cannot open file 'V:\HelloWorld.R': No such file or directory


我们认为这是一个权限问题,因为我们在访问此文件时没有问题,如果复制到当地的车道。我的理解是在使用sp_execute_external_script时,代码在驻留在本地SQLRUserGroup中的一个本地R用户的上下文中运行。
因为它是一个本地帐户,我们不得不玩弄权限来找到解决方法。基本上,您已创建共享并将Everyone组添加到共享。您可能还需要在
托管共享的服务器上创建一个具有相同名称的用户帐户。要测试本地R帐户是否可以访问共享,我们重置帐户的密码,然后以该用户身份登录到SQL服务器。然后我访问了共享并且没有任何问题(最初我被提示输入凭据
但是通过在托管共享的服务器上创建一个具有相同名称的帐户来修复此问题)。但是,即使我在登录用户时可以连接到共享,但在运行我的脚本时,它仍然会失败并出现相同的错误:(  

We believe it is a permissions issue as we have no problems accessing this file if copied to a local drive. My understanding is when using sp_execute_external_script, the code runs under the context of one of the local R users residing in the local SQLRUserGroup. As it is a local account, we had to play around with permissions to figure out a way around this. Essentially you have create a share and add the Everyone group to the share. You may also need to create an user account with the same name on the server that hosts the share. To test that the local R account could gain access to the share, we reset the password for the account and then logged onto the SQL server as that user. I then accessed the share and had no problems (initially i was being prompted for credentials but fixed this by creating an account with the same name on the server hosting the share). However, even though i can connect to the share when logged in the user, when running my script, it still fails with the SAME error :(   


有没有人经历过这个并找到了解决方案?我们正在拔头发这个问题! 

Has anyone experienced this and found a resolution?? We are pulling our hair out with this issue! 


PS我也尝试将本地驱动器映射到本地用户帐户下的共享,以防万一通过UNC访问文件时出现问题,但仍然会出现同样的错误!

P.S. I have also tried mapping a local drive to the share under this local user account just in case there is an issue with accessing files via UNC, but still get the same error!


编辑:运行以下R脚本在SQL Server 2016(SSMS)中:

Running the following R script in SQL Server 2016 (SSMS):





推荐答案

Neile,

Neile,

您是否禁用了默认安装的本地Windows防火墙规则?出站规则命名为"阻止SQL Server实例中R本地用户帐户的网络访问..." "并阻止本地用户帐户的所有出站网络流量。

Have you disabled the local Windows firewall rule that is installed by default? The outbound rule is named "Block network access for R local user accounts in SQL Server instance ..." and blocks all outbound network traffic for the local user accounts.

https://docs.microsoft.com/en-us/sql/advanced-analytics/r/security-considerations -for-the-r-runtime-in-sql-server

https://docs.microsoft.com/en-us/sql/advanced-analytics/r/security-considerations-for-the-r-runtime-in-sql-server

Bob


这篇关于通过sp_execute_external_script执行R代码时访问网络共享所需的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆