Possible Duplicate:
How can I set the umask from within java?
How do you set file permissions to 777(or any other arbitrary permission) while creating a file object in java?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you set the
umask(2)to0before starting the JVM, all files and directories created will be created with full permissions for everyone. This is probably a bad idea.You can use the
File.setReadable(),File.setWritableAPIs to fiddle with the mode bits after the file has been created. That’s often good enough, if you’re granting permissions; if you’re trying to remove permissions from other users, then your permissions should probably be set very restrictively from the start. (umask(0777)before launching the JVM, then add permissions exactly where you want them.)