Hi,

I have a problem with file permissions of a file that I create from within a web-app running in tomcat: I get certain data from the user via the webapp and want to save this into a new file on the computer where tomcat runs on. Creating the file via FileOutputStream works fine. But the problem is, that the created file has the file-permissions rw------- although the system wide umask and the user-set umask say, that new files should be rw-r--r--.

I even tried to manually set a umask manually in catalina.sh but that does not show any effect.

So I decided to change the permissions of the file by executing chmod via Runtime.exec().

In a small java-test-programm this works fine:

import java.io.*;

public class chmod {
        public static void main (String[] args){
                try {
                        Runtime run = Runtime.getRuntime();
                        Process p = run.exec("/bin/chmod 660 
/home/sarek/test/testfile");
                        p.waitFor();
                }
                catch (Exception e){}
        }
}


However, when I execute the same code from within tomcat the permissions are not hanged the way I want them to. For example, I cannot give read-access to the group, i.e. change the perms from rw------- to rw-r-----. Its simply does not show any change at all. (But there is no execption or any error message in any of the log files)

Strangely, setting the permission to 007 which would be ------rwx works as expected.

Can anyone help me please? I need to set the file to be group-readable because it is used by other users on the system as well.

TIA

Christian

--
To reply to this posting directly use the following address and
remove the 'NO-SPAM' part: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to