1

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.

squillman
  • 13,363
  • 3
  • 41
  • 60
Paul Creasey
  • 28,321
  • 10
  • 54
  • 90

2 Answers2

0

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.

squillman
  • 13,363
  • 3
  • 41
  • 60
  • I don't know if there is some special set up already done, but as far as i know accessing a drive through c$ type syntax does not mean it is, or has to be shared! – Paul Creasey Mar 22 '11 at 21:07
  • @Paul: Anything you connect to using the syntax `\\server\name` by definition is a share. `c$` is a special administrative share that is tied to the root level of C:. In this case you will need to run Nant using an account that has local admin access to the server. Just because you don't have a drive letter referencing it doesn't mean it's not a share. – squillman Mar 22 '11 at 21:48
0

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.

CrazyDart
  • 3,803
  • 2
  • 23
  • 29