Thanks for your help. I will try JCIFS. Your are correct about using a dedicated account. But on the tomcat server which I am deploying the servlet, has other servlets and It is not feasible for me to change its access rights.
Once again thanks a lot. br1 wrote: > > You can try with jcifs (http://jcifs.samba.org/). > It should allow you to access a remote share using a different user > context, though I'd reccommend using a dedicated account for this kind of > job. > > Hope it helps, > b. > > > nitin403 wrote: >> >> >> >> Juha Laiho wrote: >>> >>> nitin403 wrote: >>>> I have create a servlet which needs to read a file on a share folder. >>>> When I run tomcat service as anonymous it is not able to access read >>>> this >>>> file. >>>> But when I run tomcat service as a user who as access to this file, >>>> then it >>>> runs fine. >>>> >>>> My Question is, is it possible to something similar to this in servlet >>>> code >>>> at run time for running the servlet in tomcat. >>> >>> No, you can't change Tomcat user at runtime. What you can do is to >>> run Tomcat as a specific user, and allow that spcific user to access >>> the files it needs to (via group membership or a per-account >>> permission). >>> -- >>> ..Juha >>> >>> --------------------------------------------------------------------- >>> To start a new topic, e-mail: users@tomcat.apache.org >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >> >> Thanks for your help Juha Laiho. >> >> The reason for my asking this question was that every time I deploy this >> servlet on any system then I have to always make the tomcat to with the >> user. >> >> Is there no other way in java to read a file. >> >> Thanks for your help in advance. >> >> > > -- View this message in context: http://www.nabble.com/How-to-specify-windows-user-in-runtime-in-tomcat--tp14247742p14331879.html Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]