• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Creating a file with proper permissions in linux - URGENT

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Is there anyway using merely java.io or java.nio apis to create a new file with proper permissions for user, group and others? If not, how can I do it with Linux system calls? (I know creat might help, but I am not sure how to pass the permissions stuff it).
Any help appreciated.
Thanks,
Payam.
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Umm, I don't know if there is a way to do it with the java.io or java.nio package. The command on Linux and Unix to set permissions is chmod. It takes either a symbolic or numeric argument. For example:

Gives the user, group and world read, write and execute permission. Here is the numeric version:

Here is a link to the man page: CHMOD(1)
Michael Morris
 
reply
    Bookmark Topic Watch Topic
  • New Topic