# How to make Hudson write to remote disk?

I have a problem writing to a remote disk using Hudson. When I write in it manually, it works.

The two computers implied: one is on Windows XP and the other is a Mac mini server. The disk that needs to be accessed remotely is on the Mac. I succeeded in the following:

• Created a user on the Mac
• Mounted the filesystem on the WinXP machine using the credentials of the user created above
• Created a couple directories, moved files around, etc. remotely (from the WinXP computer)

But when Hudson runs its build script which I programmed to write things in that mounted folder, it fails, saying

BUILD FAILED
C:\path\to\build.xml:62:
Directory Z:\mac\path creation was not successful for an unknown reason


I can create Z:\mac\path from the same computer (remotely) and it works just fine. In fact, the directory already exists but I want it to try to create it anyway in case it was delete. I do the very same thing on the local disk and it never complained (directory existing or not).

The corresponding Ant instruction would be

<mkdir dir="Z:/mac/path/"/>


I would suspect a permission problem of some kind. Not too sure. The user which mounted the disk on the computer is not SYSTEM... while Hudson is ran by "him". The usernames on the WinXP computer have nothing to do with the Mac user used to mount the remote filesystem (NTFS).

What could I try to do? It is well mounted as Z:. I can browse and edit it no problem. That line still doesn't compute in Hudson though (while it goes through on C:). I wouldn't think it's possible to mount it using SYSTEM... Help, please!

-
Someone suggested FTP... didn't work so well, plus it was weird to set on the Mac. I then thought of SCP and there was effectively an <scp> task in Ant already (there was one for FTP too anyway). SCP seems to work good right now, though it was certainly not so straightforward to set up. Thanks for the suggestion anyway. Don't know why you deleted the post. – Joanis Sep 12 '11 at 4:46

I just solved a similar problem so hopefully this solution works for you ...but it has been 9 months so perhaps it will help the next person. The basic problem is that if Tomcat runs as a service your scripts execute as SYSTEM.

Open a cmd prompt as SYSTEM to test (set time to a minute from now)

at 12:34 /interactive "cmd.exe"


Test away...

C:\.jenkins\jobs\test\workspace>dir \\remotemachine\folder
Access is denied.


Solve by mapping drive as a user with sufficient permissions (in this case write access)

NET USE z: \\remotemachine\folder password /USER:username\domain

-

The usernames on the WinXP computer have nothing to do with the Mac user used to mount the remote filesystem (NTFS).

Try creating an account with the same username/password on both systems, and have your Hudson process (or service if you've got it installed that way) run as that user.

The other way would be to use the 'NET USE' command as mentioned by KCD, however the /USER parameter options are domain\username not username\domain.

I'm using the NET USE command in my environment to map and then write a remote drive on a NAS so it definitely can be done that way.

-