• 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

linux file permissions

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This maybe a stupid question, but I am creating a program and I need to know the linux file permissions of a file object. Is there a method or set of methods that can be used to get the read, write, and execution permissions for the owner, group, and everyone else?
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eric Fox:
This maybe a stupid question, but I am creating a program and I need to know the linux file permissions of a file object. Is there a method or set of methods that can be used to get the read, write, and execution permissions for the owner, group, and everyone else?


I am not aware of such a thing.You can figure out file permission with ls command.You could try using java's Runtime.getRuntime().exec(cmd) ;method to run the command. It probably did not help but ...
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you will have to use JNI to get the permissions in C.
Why Sun couldn't have come up with some generic model of permissions is beyond me. Or even just a *nix version.
 
Eric Fox
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I figure that I will just use the exec command on ls and get the string of file permissions from the output. It is a round about way but it should work. Thanks for your replies, they helped me to come to this.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic