将文件复制到需要不同凭据的本地驱动器
我看到了很多关于复制文件的答案,这些文件使用代码设置网络共享和凭据,以复制到其他地方。但是,我需要一个解决方案,允许用户从他们已经有权访问的网络共享复制到他们无权访问的本地驱动器。
我们运行 RDS 服务器,并锁定了对服务器上本地 C:/ 驱动器的直接访问。我们获得了一个第 3 方程序,该程序需要读取必须存储在 C:/ 驱动器上固定路径中的数据文件。这些数据文件每月更新一次。我们的用户具有读取权限,但我们不想给他们对根 C:/ 驱动器的直接写入权限。
我需要在 .bat 文件中编写一段 vb.net 或命令行代码,将文件复制到本地 C:/,同时提供服务帐户的详细信息以提供访问权限。
如前所述,我已经看到了很多有关设置共享文件夹映射和传递凭据的信息,但是我们不想在本例中将 C:/ 设置为映射共享驱动器。
I've seen a lot of answers on copying files that use code to set a network share, with credentials, to copy to somewhere else. However I need a solution that will allow a user to copy from a network share they already have access for, to a local drive they don't have access to.
We run RDS servers and have locked down direct access to the local C:/ drive on the servers. We have been given a 3rd party program that needs to read data files that must be stored in a fixed path on the C:/ drive. These data files are updated once a month. Our users have read access but we do not want to give them direct write access to the root C:/ drive.
I need to write a piece of vb.net, or command line code in .bat file that will copy files to the Local C:/ whilst providing the details of a service account to provide the access.
As mentioned I've seen a lot about setting up a mapping to shared folder and passing creds, however we don't want to set the C:/ as mapped shared drive in this instance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说,您不希望用户有权访问 C 驱动器,是否有任何特殊原因导致文件的特定子文件夹的权限不能具有重写权限以允许仅写入该文件夹?
如果这不起作用,首先想到的是拥有一个可以在具有该访问权限的不同用户下运行的帮助程序。设置用户可以写入的中间文件夹,他们可以启动的程序将文件放入他们有权访问的文件夹中。帮助程序监视中间文件夹中的文件,将它们移动到需要的位置。
设置需要包括添加一个有权访问这两个位置的用户,然后添加到任务管理器以在登录时在该其他用户下启动帮助程序。
You don't want the user having access to the C Drive in general, is there any particular reason the permissions on the particular subfolder the files are going to can't have overriding permissions to allow writing to just that folder?
If that will not work, first thought that comes to mind is having a helper program that can be ran under a different user that does have that access. Set up an intermediate folder the user can write to, the program that they can launch drops the files into a folder they have access to. Helper program watches for files in the intermediate folder, moves them to where they need to be.
Set up would need to include adding a user that does have access to both locations, and then adding to task manager to launch the helper program under that other user at login.