Nant task copy UNC with a drive specified (eg. \\server\c$\program files\blah)

孤街浪徒 提交于 2019-12-11 13:13:26

问题


I would like to use Nant to copy files to a path like \\server\c$\program files\blah.

To access this path, I first need to go \\server\c$ and enter and user and password, then the former path will work.

Is there any way to do this automatically in Nant.

I don't want to expose the folder as a share, security is tight and the share may get removed, especially since it will require write permissions.


回答1:


You have 2 options, start the nant script with a user that has access to that admin share, or exec a runas in the nant script for the copy. The runas will require you to put the password in clear text.




回答2:


The folder is already exposed as a share. If you can reach it via a UNC Path (ie- \\server\share) then it's available as a share. If it's not exposed as a share then you're not going to be able to write to it accross the network unless you use other protocols.

The better thing to do is to have security on the share & destination folder changed so that whichever account you're running Nant under has access to that folder.

Alternatively, change the account you run Nant with to one that has access to that share & folder.

Either way, you won't have to manually enter authentication anymore.



来源:https://stackoverflow.com/questions/5397359/nant-task-copy-unc-with-a-drive-specified-eg-server-c-program-files-blah

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!