Re: Changing file permissions from within tomcat does not work
On Thu, Aug 19, 2004 at 11:28:16AM +0200, Christian Riedel wrote: : 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'm grasping here, but maybe there's something SecurityManager? : 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. Barring a Tomcat- or Java-only solution, you could run a cronjob that periodically sets perms on the files in the upload dir. -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Changing file permissions from within tomcat does not work
On 19.08.2004 15:35, QM wrote: On Thu, Aug 19, 2004 at 11:28:16AM +0200, Christian Riedel wrote: : 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'm grasping here, but maybe there's something SecurityManager? hmm if so, it would be a Tomcat-Internal-Security Manager as the standalone test application I wrote works fine with doing the chmod. It only is not possible from within tomcat / the struts appliuation : 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. Barring a Tomcat- or Java-only solution, you could run a cronjob that periodically sets perms on the files in the upload dir. That is no option I am afriad, right after saving the file a script is called from the Application which has to read the file. And this script runs under a different user and grouid 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]
RE: Changing file permissions from within tomcat does not work
Hola, This is typical of when apps step outside the Servlet Spec, which does not include support for apps writing files except to a temporary directory where permissions are guaranteed to be readable back by the app and no more. Tomcat supports running with a security manager, but you have to tell it so explicitly by specifying -security when launching Tomcat. If you're doing this, you will need to modify your java security policy to include setting file permissions. But my guess is you're running without a security manager, which is OK and the default. So Runtime.exec should work. You will need to pass it the complete path to the file, as you cannot rely on the concept of current working directory to be portable. Runtime.exec is also a security risk in most environments. Yoav Shapira Millennium Research Informatics -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Christian Riedel Sent: Thursday, August 19, 2004 10:22 AM To: [EMAIL PROTECTED] Subject: Re: Changing file permissions from within tomcat does not work On 19.08.2004 15:35, QM wrote: On Thu, Aug 19, 2004 at 11:28:16AM +0200, Christian Riedel wrote: : 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'm grasping here, but maybe there's something SecurityManager? hmm if so, it would be a Tomcat-Internal-Security Manager as the standalone test application I wrote works fine with doing the chmod. It only is not possible from within tomcat / the struts appliuation : 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. Barring a Tomcat- or Java-only solution, you could run a cronjob that periodically sets perms on the files in the upload dir. That is no option I am afriad, right after saving the file a script is called from the Application which has to read the file. And this script runs under a different user and grouid 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Changing file permissions from within tomcat does not work
just as a gues have you sat the Sticky or the UID bit of your directory? Shapira, Yoav escribió: Hola, This is typical of when apps step outside the Servlet Spec, which does not include support for apps writing files except to a temporary directory where permissions are guaranteed to be readable back by the app and no more. Tomcat supports running with a security manager, but you have to tell it so explicitly by specifying -security when launching Tomcat. If you're doing this, you will need to modify your java security policy to include setting file permissions. But my guess is you're running without a security manager, which is OK and the default. So Runtime.exec should work. You will need to pass it the complete path to the file, as you cannot rely on the concept of current working directory to be portable. Runtime.exec is also a security risk in most environments. Yoav Shapira Millennium Research Informatics -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Christian Riedel Sent: Thursday, August 19, 2004 10:22 AM To: [EMAIL PROTECTED] Subject: Re: Changing file permissions from within tomcat does not work On 19.08.2004 15:35, QM wrote: On Thu, Aug 19, 2004 at 11:28:16AM +0200, Christian Riedel wrote: : 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'm grasping here, but maybe there's something SecurityManager? hmm if so, it would be a Tomcat-Internal-Security Manager as the standalone test application I wrote works fine with doing the chmod. It only is not possible from within tomcat / the struts appliuation : 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. Barring a Tomcat- or Java-only solution, you could run a cronjob that periodically sets perms on the files in the upload dir. That is no option I am afriad, right after saving the file a script is called from the Application which has to read the file. And this script runs under a different user and grouid 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Changing file permissions from within tomcat does not work
On 19.08.2004 16:36, John Villar wrote: just as a gues have you sat the Sticky or the UID bit of your directory? No, I have not ... when I cd to the directory and do a touch testfile on the cosole the file's permissions are as expected rw-r--r-- So why should it not work from within Tomcat? 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]
Re: Changing file permissions from within tomcat does not work
And the directory's permissions are the same? (should be, but just in case) remember that new files don't necesarilly have rw-r--r-- permissions Christian Riedel escribió: On 19.08.2004 16:36, John Villar wrote: just as a gues have you sat the Sticky or the UID bit of your directory? No, I have not ... when I cd to the directory and do a touch testfile on the cosole the file's permissions are as expected rw-r--r-- So why should it not work from within Tomcat? Christian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Changing file permissions from within tomcat does not work
On 19.08.2004 16:31, Shapira, Yoav wrote: Hola, This is typical of when apps step outside the Servlet Spec, which does not include support for apps writing files except to a temporary directory where permissions are guaranteed to be readable back by the app and no more. Tomcat supports running with a security manager, but you have to tell it so explicitly by specifying -security when launching Tomcat. If you're doing this, you will need to modify your java security policy to include setting file permissions. But my guess is you're running without a security manager, which is OK and the default. So Runtime.exec should work. You will need to pass it the complete path to the file, as you cannot rely on the concept of current working directory to be portable. Runtime.exec is also a security risk in most environments. Thats what I thought ... and as you can see from my original posting I am passing the full path to chmod and the full path to the file when calling exec() ... The thing is: I can see that chmod itself seems to do something, but in a completely weird and unwanted way ... why should it work when I want to set the permission to 007 (which actually is working - even from within the application) But not, when I want to ste the permissions to 660 This seems totally unpredictable and unexplainable to me :-( Any more hints? But maybe I can try it with the security option tomorrow 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]
Re: Changing file permissions from within tomcat does not work
On 19.08.2004 17:47, John Villar wrote: And the directory's permissions are the same? (should be, but just in case) remember that new files don't necesarilly have rw-r--r-- permissions The directories permissions are drwxrwxr-x and the system wide umask is 0002 As I said: when I create a file via touch filename it works great but the applications file always get rw--- 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]