• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

grant write access to folder in unix

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a web application which creates a folder in unix box for a particular request. I was able to create the folder but when other users try to write file to this folder it shows no write permission error. The folder is created by user1 and for user2 wont be able to modify the folder owned by user1.

Is it possible to grant write permission (all users) to the folder from java. I had a look at java.io.File api but could not find anything useful. Any help on this is appreciated.

Thanks,
Rajeev
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can always call (using Runtime.exec or ProcessBuilder) the external program: chmod.
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Rob!

I wrote a small java program to test ProcessBuilder and it worked fine but when i copied the same piece of code into my web application. I am getting exception . The application is deployed on solaris 10 so "chmod: not found " is making me confused. Any thoughts ?






08/11/24 14:03:59 bool : Folder Created !! yay.
08/11/24 14:03:59 Directories: /prj/public/apps/200811020_MSM7600 created

08/11/24 14:03:59 java.io.IOException: chmod: not found
08/11/24 14:03:59 at java.lang.UNIXProcess.forkAndExec(Native Method)
08/11/24 14:03:59 at java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
08/11/24 14:03:59 at java.lang.ProcessImpl.start(ProcessImpl.java:65)
08/11/24 14:03:59 at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
08/11/24 14:03:59 at com.qualcomm.qct.fadb.factory.RMAJobImpl.createJobFolder(RMAJobImpl.java:147)
08/11/24 14:03:59 at com.qualcomm.qct.fadb.ui.bean.BaseHandler.createJobFolder(BaseHandler.java:1138)
08/11/24 14:03:59 at com.qualcomm.qct.fadb.ui.bean.RMAJobHandlerBean.saveJob(RMAJobHandlerBean.java:466)
08/11/24 14:03:59 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
08/11/24 14:03:59 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
08/11/24 14:03:59 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
08/11/24 14:03:59 at java.lang.reflect.Method.invoke(Method.java:585)
08/11/24 14:03:59 at com.sun.el.parser.AstValue.invoke(AstValue.java:151)
08/11/24 14:03:59 at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
08/11/24 14:03:59 at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
08/11/24 14:03:59 at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
08/11/24 14:03:59 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
08/11/24 14:03:59 at javax.faces.component.UICommand.broadcast(UICommand.java:383)
08/11/24 14:03:59 at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:317)
08/11/24 14:03:59 at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:292)
08/11/24 14:03:59 at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:249)
08/11/24 14:03:59 at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:462)


[ November 24, 2008: Message edited by: Rajeev Ravindran ]
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok nevermind Had to change lst.add("chmod"); to lst.add("/usr/bin/chmod"); to make it run from the app. i still need to work on my unix knowledge

Thanks,
 
reply
    Bookmark Topic Watch Topic
  • New Topic