From: Dan Hertz <[EMAIL PROTECTED]>
Date: Fri, 02 Jun 2006 08:45:14 -0600

Thanks for helping me out, Gianugo. I'm not sure I follow though -- is umask not meant to *subtract* values, in other words, 0777 - 002 = 0775.

Yes, that's right.

But if my system default (set by the ISP) is 0755, how do I use umask to *bump it up* to 0775?

If it's 0755, that'll be because you're currently using a umask of 022, possibly set in some system-wide default configuration file. You won't be using a user-specific umask to "bump it up", rather you'll be overriding their default with a user-specific value of 002, so that's what will be subtracted from the 777 instead.

One other quirk, though it shouldn't affect you in this case, is that files start with 666 rather than 777, so it's impossible to create an executable file (you have to explicity chmod it after creation to make it executable). And, strictly speaking, the mask isn't subtracted but it does a logical "and" with the complement of the umask (so 666 with a umask of 003 gives 664 not 663...) But that's just being pedantic ;-)


Daniel

PS I'm a Windows guy, so please bear with me...

Some of these[1] may help.


Andrew.

[1] http://www.google.co.uk/search?&q=umask%20default%20unix%20permissions


===============

On 6/1/06, Dan Hertz wrote:
Hi,

The following flowscript dynamically makes a directory and uploads a
photo to it:

===Extracts===

  var uploadWidget = form.lookupWidget("upload");
  if (uploadWidget.getValue() != null) {

      // test if user directory exists, if not, create it
       if (!userDir.exists()) {
           userDir.mkdirs();
       }
    uploadWidget.getValue().copyToFile(userDir + "/" + fileName);
  }

===========

On Windows this works great; but on LINUX, the folder gets created with
0755 permissions (set by my ISP). This is insufficient to run my PHP
script on the photo -- which needs the folder to be set to 0774.

How do I set the folder permission values from this flowscript?

"umask" is your friend. You should set it in your account profile and
it will create files/dir with proper permissions. In your case, you
need to set it to something like 002 (IIRC, but YMMV). Of course, if
you don't have shell access (or ftp access) to your home dir, you're
out of luck...

Ciao,
--
Gianugo Rabellino



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

Reply via email to