• Post Reply Bookmark Topic Watch Topic
  • New Topic

Creating a file with proper permissions in linux - URGENT

 
Payam Fard
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • 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.
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!