You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mitch Gitman <mg...@gmail.com> on 2008/12/07 00:23:14 UTC
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?
RE: Tomcat vs. Samba
Posted by Martin Gainty <mg...@hotmail.com>.
A few questions
Do you know what the service is actually doing?
Do you see any events in application or system queue that deliver any useful information?
If you're willing to
a)listen to endless rants by supposed windoze gurus
b)be willing to debug service binaries get a copy of dumpbin /read it/ and understand all of the contents
get a copy of sc.exe and determine what the current configuration and state information for the service
then stay with 'windows service'
otherwise use java -jar bootstrap.jar and configure the necessary parameters with -D
when Windows services go awry there is no fallback or debug or diagnosis capabilities
and of course the rants from windoze experts will lead you away from whats really going on
Viel Gluck
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: Sun, 7 Dec 2008 16:22:06 -0800
Subject: Re: Tomcat vs. Samba
From: mgitman@gmail.com
To: users@tomcat.apache.org
Charles, you nailed it. Major thanks. I owe you a bottle of wine or something.
Yes, I was running Tomcat as a Windows service, and it should have dawned on me that somehow that was part of the equation.
If I go ahead and run the Tomcat executable directly, the Samba access does work without specifying "Guest OK = Yes". Because it's running as "me," and not some obscure Windows service account.
I think I'm going to continue to run the executable directly rather than as a Windows service. Two reasons:
1. Only now do I realize that, when I was seeing the user.home property showing up as C:\, that was a function of running as a Windows service. If I just run as the current user, the expected user home gets used. Same for the weird value I was seeing for user.name, which was machine_name$.
2. I literally can't solve this problem while still running as a Windows service. If I go to "Configure Tomcat," a.k.a. tomcat6w.exe, neither my user account nor any other account listed is selectable. Apparently, this is a function of the account not being configured to "log on as a service." Now, there is a "Local Security Policy" admin tool where you can configure accounts to do just this. But that tool is only on Windows Vista Professional, and the spare machine I'm using for Hudson builds has Windows Vista Home.
Anyway, moral of the story: blame Windows.
On Sun, Dec 7, 2008 at 12:37 PM, Caldarale, Charles R <Ch...@unisys.com> wrote:
> From: mgitman@gmail.com
> Subject: Tomcat vs. Samba
> 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).
Windows is notorious for caching SMB credentials and insisting on using those rather than ones explicitly given on the APIs. We've gone round and round with this talking to the developers in Redmond, and they finally admitted they didn't really understand fully how it works or even all the different places credentials are hung on to. No resolution has yet to be found. (Perhaps that's why Vista has a completely new version of SMB implemented - although that's got its own set of problems.)
All that being said, if you're running Tomcat as a Windows service, it is likely using the Local System Account, which may be getting sent on the SMB connection request. You can try configuring the account you want Tomcat to use with the tomcat6w.exe program and see if that will connect with Samba on the Linux system.
(Ignore Martin's response - he obviously didn't even figure out that you're running Tomcat on Windows, since he recommended starting it with sudo.)
MG: Hey, I'm grateful for any feedback I can get.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
_________________________________________________________________
You live life online. So we put Windows on the web.
http://clk.atdmt.com/MRT/go/127032869/direct/01/
RE: Tomcat vs. Samba
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: André Warnier [mailto:aw@ice-sa.com]
> Subject: Re: Tomcat vs. Samba
>
> - when you have such a user-id/password, then go into the
> "Services" applet (My computer...,Manage.., Services and
> Applications,.. Services, right-click on Tomcat in the right
> panel, choose Properties, and the "Logon as" tab.
You can also do this with the tomcat6w.exe program that comes with Tomcat. For Vista, you have to use the "Run as Administrator" option to launch tomcat6w.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat vs. Samba
Posted by Mitch Gitman <mg...@gmail.com>.
André, thanks. I can confirm that changing the log-on user in Services
worked. As Charles notes in the subsequent post, I can see now that the "Log
On" tab in "Configure Tomcat" (tomcat6w.exe) mimics the "Log On" tab for a
service's properties in the Services admin tool.
On Mon, Dec 8, 2008 at 1:14 AM, André Warnier <aw...@ice-sa.com> wrote:
> Mitch Gitman wrote:
>
>>
>> 2. I literally can't solve this problem while still running as a Windows
>> service.
>>
> [...]
> Yes you can...
>
> - the LocalSystem account is special, one of the special things about it
> being that it cannot access Windows network resources.
> - if you need Tomcat to access Windows network resources, such as "shares",
> then you need to run Tomcat under another user-id. If the system is part of
> a Domain, and if to access network resources you need to be logged in the
> Domain, then you need a valid Windows Domain user-id (and password) in order
> to run Tomcat as such a user-id.
> (You can test with your own id).
> - when you have such a user-id/password, then go into the "Services" applet
> (My computer...,Manage.., Services and Applications,.. Services, right-click
> on Tomcat in the right panel, choose Properties, and the "Logon as" tab.
> Then change the user-id "Local System" to the Domain user-id above, enter
> its password. The account will then automatically receive the permission to
> "run as a service" (it will tell you).
> - Now if you start the Tomcat service, it will run as that user, with the
> normal environment of that user.
> You just have to make sure that all the files/directories Tomcat needs are
> accessible by the user-id you are running Tomcat under.
>
> A tip, if this is for a "persistent" installation : the user-id under which
> Tomcat runs should have a password that does not "age" (aka does not need to
> be changed every so often), because if it does, then after a while your
> Tomcat will not start anymore.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Tomcat vs. Samba
Posted by André Warnier <aw...@ice-sa.com>.
Mitch Gitman wrote:
>
> 2. I literally can't solve this problem while still running as a Windows
> service.
[...]
Yes you can...
- the LocalSystem account is special, one of the special things about it
being that it cannot access Windows network resources.
- if you need Tomcat to access Windows network resources, such as
"shares", then you need to run Tomcat under another user-id. If the
system is part of a Domain, and if to access network resources you need
to be logged in the Domain, then you need a valid Windows Domain user-id
(and password) in order to run Tomcat as such a user-id.
(You can test with your own id).
- when you have such a user-id/password, then go into the "Services"
applet (My computer...,Manage.., Services and Applications,.. Services,
right-click on Tomcat in the right panel, choose Properties, and the
"Logon as" tab.
Then change the user-id "Local System" to the Domain user-id above,
enter its password. The account will then automatically receive the
permission to "run as a service" (it will tell you).
- Now if you start the Tomcat service, it will run as that user, with
the normal environment of that user.
You just have to make sure that all the files/directories Tomcat needs
are accessible by the user-id you are running Tomcat under.
A tip, if this is for a "persistent" installation : the user-id under
which Tomcat runs should have a password that does not "age" (aka does
not need to be changed every so often), because if it does, then after a
while your Tomcat will not start anymore.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat vs. Samba
Posted by Mitch Gitman <mg...@gmail.com>.
Charles, you nailed it. Major thanks. I owe you a bottle of wine or
something.
Yes, I was running Tomcat as a Windows service, and it should have dawned on
me that somehow that was part of the equation.
If I go ahead and run the Tomcat executable directly, the Samba access does
work *without *specifying "Guest OK = Yes". Because it's running as "me,"
and not some obscure Windows service account.
I think I'm going to continue to run the executable directly rather than as
a Windows service. Two reasons:
1. Only now do I realize that, when I was seeing the user.home property
showing up as C:\, that was a function of running as a Windows service. If I
just run as the current user, the expected user home gets used. Same for the
weird value I was seeing for user.name, which was *machine_name*$.
2. I literally can't solve this problem while still running as a Windows
service. If I go to "Configure Tomcat," a.k.a. tomcat6w.exe, neither my user
account nor any other account listed is selectable. Apparently, this is a
function of the account not being configured to "log on as a service." Now,
there is a "Local Security Policy" admin tool where you can configure
accounts to do just this. But that tool is only on Windows Vista
Professional, and the spare machine I'm using for Hudson builds has Windows
Vista Home.
Anyway, moral of the story: blame Windows.
On Sun, Dec 7, 2008 at 12:37 PM, Caldarale, Charles R <
Chuck.Caldarale@unisys.com> wrote:
> > From: mgitman@gmail.com
> > Subject: Tomcat vs. Samba
>
> > 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).
>
> Windows is notorious for caching SMB credentials and insisting on using
> those rather than ones explicitly given on the APIs. We've gone round and
> round with this talking to the developers in Redmond, and they finally
> admitted they didn't really understand fully how it works or even all the
> different places credentials are hung on to. No resolution has yet to be
> found. (Perhaps that's why Vista has a completely new version of SMB
> implemented - although that's got its own set of problems.)
>
> All that being said, if you're running Tomcat as a Windows service, it is
> likely using the Local System Account, which may be getting sent on the SMB
> connection request. You can try configuring the account you want Tomcat to
> use with the tomcat6w.exe program and see if that will connect with Samba on
> the Linux system.
>
> (Ignore Martin's response - he obviously didn't even figure out that you're
> running Tomcat on Windows, since he recommended starting it with sudo.)
MG: Hey, I'm grateful for any feedback I can get. [?]
>
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Tomcat vs. Samba
Posted by André Warnier <aw...@ice-sa.com>.
Caldarale, Charles R wrote:
>
> All that being said, if you're running Tomcat as a Windows service, it is likely using the Local System Account,
...
And, for information, one of the characteristics of the LocalSystem
account is that it does not have access to any Windows network
resources, such as shares.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat vs. Samba
Posted by Martin Gainty <mg...@hotmail.com>.
and ignore comments from people who dont understand how to use sudo
feel free to ping me offline to get away from any more idiotic responses
Martin Gainty
______________________________________________
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.
> From: Chuck.Caldarale@unisys.com
> To: users@tomcat.apache.org
> Date: Sun, 7 Dec 2008 14:37:50 -0600
> Subject: RE: Tomcat vs. Samba
>
> > From: mgitman@gmail.com
> > Subject: Tomcat vs. Samba
>
> > 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).
>
> Windows is notorious for caching SMB credentials and insisting on using those rather than ones explicitly given on the APIs. We've gone round and round with this talking to the developers in Redmond, and they finally admitted they didn't really understand fully how it works or even all the different places credentials are hung on to. No resolution has yet to be found. (Perhaps that's why Vista has a completely new version of SMB implemented - although that's got its own set of problems.)
>
> All that being said, if you're running Tomcat as a Windows service, it is likely using the Local System Account, which may be getting sent on the SMB connection request. You can try configuring the account you want Tomcat to use with the tomcat6w.exe program and see if that will connect with Samba on the Linux system.
>
> (Ignore Martin's response - he obviously didn't even figure out that you're running Tomcat on Windows, since he recommended starting it with sudo.)
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
_________________________________________________________________
Send e-mail anywhere. No map, no compass.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_anywhere_122008
RE: Tomcat vs. Samba
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: mgitman@gmail.com
> Subject: Tomcat vs. Samba
> 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).
Windows is notorious for caching SMB credentials and insisting on using those rather than ones explicitly given on the APIs. We've gone round and round with this talking to the developers in Redmond, and they finally admitted they didn't really understand fully how it works or even all the different places credentials are hung on to. No resolution has yet to be found. (Perhaps that's why Vista has a completely new version of SMB implemented - although that's got its own set of problems.)
All that being said, if you're running Tomcat as a Windows service, it is likely using the Local System Account, which may be getting sent on the SMB connection request. You can try configuring the account you want Tomcat to use with the tomcat6w.exe program and see if that will connect with Samba on the Linux system.
(Ignore Martin's response - he obviously didn't even figure out that you're running Tomcat on Windows, since he recommended starting it with sudo.)
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat vs. Samba
Posted by Mitch Gitman <mg...@gmail.com>.
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 <mg...@hotmail.com> 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: mgitman@gmail.com
> > 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
>
RE: Tomcat vs. Samba
Posted by Martin Gainty <mg...@hotmail.com>.
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: mgitman@gmail.com
> 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