tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Kerber <dcker...@verizon.net>
Subject Re: runtime.exec "cmd.exe /C net use"
Date Sun, 24 Mar 2013 02:00:28 GMT
On 3/23/2013 8:13 PM, Harris, Jeffrey E. wrote:
>
>
>> -----Original Message-----
>> From: André Warnier [mailto:aw@ice-sa.com]
>> Sent: Saturday, March 23, 2013 8:10 PM
>> To: Tomcat Users List
>> Subject: Re: runtime.exec "cmd.exe /C net use"
>>
>> Harris, Jeffrey E. wrote:
>>>
>>>> -----Original Message-----
>>>> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
>>>> Sent: Saturday, March 23, 2013 5:22 PM
>>>> To: Tomcat Users List
>>>> Subject: runtime.exec "cmd.exe /C net use"
>>>>
>>>> Hi,
>>>>
>>>> I'm trying to run the following command ( runtime.exec "cmd.exe /C
>>>> net use" ) from my tomcat app and it's returning :
>>>>
>>>> net use
>>>> New connections will be remembered.
>>>>
>>>> There are no entries in the list.
>>>>
>>>> This only happen when I run as a Windows service. If I run the
>> tomcat
>>>> batch file to start tomcat then "net use" returns all my mapped
>>>> network drives. The service login is an account that has access to
>>>> the network shares as my app uses those shares, but the service
>> login
>>>> should not preclude the command from executing properly. If I
>>>> substitute "dir" for "net use"
>>>> that works and I get a directory listing. The combo of "net use"
>>>> command using cmd.exe and running as a service seems to be the
>>>> conflict.
>>>>
>>>> Any input much appreciated.
>>>>
>>>> Thanks
>>>> Pat
>>
>> I would add that it is kind of doubtful that this has anything directly
>> to do with Tomcat, or even Java.  Maybe that question would belong more
>> to some Windows forum.
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>
> I absolutely agree.  I would expect to see the same behavior with Apache HTTPD, IIS,
or
> any other service that accesses mapped drives.  It is a question of how service accounts
behave
> in the windows architecture, rather than something specific with Tomcat.
>
> Jeffrey Harris

It will depend on what user your TC service is running under.    If it's 
running as the LocalSystem user,  it will not have access to any network 
drives, or many other network resources.  It can hit some, such as 
databases.

If you want your TC to be able to see networked drives, you need to run 
it under the logged-on user's ID.  Keep in mind, though, that if the 
user logs off, the drives will be disconnected.  Your best bet in that 
case it to not connect by drive letter, but rather by the UNC name (what 
you used to map it when you were logged on).  That will work if the user 
TC is running has has the appropriate permissions to the network resource.

D


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message