Martin, thanks for your input. Nothing in the Tomcat logs, not really that I
would expect there to be. I also tried running Ant in verbose mode. No
information there either. This credentials exchange is happening below the
radar of these Java tools. You are on the right track, though, when it comes
to Samba configuration.

Let me share the workaround I finally got working. Samba has a configuration
file, /etc/samba/smb.conf. For the entry in that file where I define the
share, I added this line:
   guest ok = yes

With that, my little Ant read test worked when invoked by Hudson.

Next, I set the permission on the Linux parent directory to allow write
access to "other" users--i.e. not owner user, not owner group. In other
words, I executed: chmod 777...

With that, my original Ant upload target worked when invoked by Hudson.

Obviously, this is a workaround since it involves not just anonymous access
but anonymous uploads/writes.

Clearly, the username and password Windows obtains on "Map network drive"
are being passed to Ant when invoked manually, but not when invoked by
Hudson.

On Sat, Dec 6, 2008 at 7:09 PM, Martin Gainty <[EMAIL PROTECTED]> wrote:

>
> check your tomcat logs for access to samba.conf
> its possible you might have to use sudo to access the samba configuration
> if thats the case start tomcat with sudo
> https://help.ubuntu.com/6.06/ubuntu/serverguide/C/configuring-samba.html
>
> Martin
> ______________________________________________
> Disclaimer and confidentiality note
> Everything in this e-mail and any attachments relates to the official
> business of Sender. This transmission is of a confidential nature and Sender
> does not endorse distribution to any party other than intended recipient.
> Sender does not necessarily endorse content contained within this
> transmission.
>
>
>
>
> > Date: Sat, 6 Dec 2008 15:23:14 -0800
> > From: [EMAIL PROTECTED]
> > To: users@tomcat.apache.org
> > Subject: Tomcat vs. Samba
> >
> > I'm running the Hudson continuous integration
> > server<https://hudson.dev.java.net/>webapp on Tomcat 6.0 on a Windows
> > machine. To perform a build, I have Hudson
> > invoking an Ant build script. At one point, the build script needs to
> upload
> > a file to a Linux machine. I can think of two ways to accomplish this:
> >
> >    - FTP
> >    - filesystem paths via Samba
> >
> > I've taken the latter approach, and I've set up a Samba server on that
> Linux
> > machine. ("Why not use FTP?", you ask. Well, soon enough I'll give that a
> > try.)
> >
> > I wrote a very simple Ant target to capture this problem. Instead of an *
> > upload*, it *downloads *a file from the Linux server. There are three
> > scenarios in which I've tried running this Ant target:
> >
> > #1 First, I invoke it manually without first mapping a network drive. I
> get
> > a message:
> > "Warning: Could not find file \\REPOSITORIES\... to copy."
> >
> > My Samba log shows this:
> >   check_ntlm_password:  Authentication for user [www-data] -> [www-data]
> > FAILED with error NT_STATUS_NO_SUCH_USER
> > ...
> >   guest user (from session setup) not permitted to access this share
> (ivy)
> >
> > #2 Next, I map a network drive and enter a username and password matching
> > credentials I've input using the Samba smbpasswd utility. Now when I
> invoke
> > Ant manually to do the copy, it works.
> >
> > My Samba log shows this (where "philadelphia" is the name of the Windows
> > machine running Hudson):
> > ...
> >   check_ntlm_password:  authentication for user [mgitman] -> [mgitman] ->
> > [mgitman] succeeded
> > ...
> >   philadelphia (::ffff:192.168.0.105) connect to service ivy initially
> as
> > user mgitman (uid=1000, gid=1000) (pid 6967)
> > ...
> >   mgitman opened file ... read=Yes write=No (numopen=1)
> > ...
> >   mgitman closed file ... (numopen=0) NT_STATUS_OK
> >
> > #3 Finally, I launch a build on Hudson to trigger the same Ant target. I
> get
> > the same error message as I did manually before mapping the network
> drive:
> > Warning: Could not find file \\REPOSITORIES\... to copy.
> >
> > My Samba log shows this:
> >   guest user (from session setup) not permitted to access this share
> (ivy)
> >
> > At first I thought this was a problem with Hudson specifying the wrong
> > username. By default, Hudson sets the system property user.name to
> HUDSON$ and
> > the environment variable USERNAME to HUDSON$. But even when I manually
> > specify the username, I get the same problem, and as you can see from the
> > log output above, no username is getting sent anyway.
> >
> > Then I thought this might have something to do with Tomcat running under
> a
> > more restrictive security policy. So I tried replacing the
> catalina.policy
> > file in the Tomcat conf directory with the java.policy from the JDK, of
> > course renaming the replacement to catalina.policy. But no, same problem.
> >
> > Then I tried configuring the Hudson webapp to use basic authentication
> and
> > have the username and password be the same as one of those recognized by
> > Samba. That didn't work either.
> >
> > So basically, the credentials I input when mapping the network drive get
> > picked up when invoking Ant by hand (scenario #2), but they don't get
> picked
> > up when it is Hudson running on Tomcat that is invoking Ant (scenario
> #3).
> >
> > Well, I already have those directories exposed over HTTP. You might have
> > noticed the www-data user from Apache 2 showing up in the first log. So
> it
> > wouldn't be a big deal to add the FTP. Still, it's odd that Samba should
> > work manually but not with Hudson on Tomcat. I'm left asking, what's the
> > difference?
>
> _________________________________________________________________
> Send e-mail anywhere. No map, no compass.
>
> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_anywhere_122008
>

Reply via email to