开发者

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

开发者 https://www.devze.com 2023-02-18 06:59 出处:网络
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

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 si开发者_StackOverflownce it will require write permissions.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消