Hey list.

I am trying to use the following function for a matter of security in my app:

function doDirs(uid, gid) {
    var dirs = [
        config.base+"/cache",
        config.base+"/cdn/assets",
        config.base+"/config"
    ];
    for(var i=0; dirs.length > i; i++) {
        var dir = dirs[i];
        log.info("BIRD3 Security -> "+dir+"...");
        if(!fs.existsSync(dir)) fs.mkdirSync(dir, 755);
        if(!fs.writeFileSync(dir+"/.tmp", "o.o")) {
            fs.chmodSync(dir, 755);
            fs.unlink(dir+"/.tmp", function(){});
        }
        fs.chownSync(dir, uid, gid);
    }
}

However, after this function was executed...

Ingwies-Macbook-Pro:BIRD3 Ingwie$ ls -ald cache/ cdn/assets/ config/
d-wxrw--wt+ 3 Ingwie  staff  102  9 Sep 05:08 cache/
d-wxrw--wt+ 4 Ingwie  staff  136  9 Sep 05:08 cdn/assets/
d-wxrw--wt+ 6 Ingwie  staff  204  9 Sep 05:08 config/

All my read permissions are gone O_o.

What is the correct value to make it: r w x | r - - | r - - ?

This is done before changing to a new user, assigning read/write/execute 
permissions jsut for this one user, and read-only for the rest...

The full code is found here: 
http://git.ingwie.me/ingwie/bird3/blob/master/lib/security_handler.js

Kind regards, Ingwie.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CDF5CE0E-A06C-428A-A753-D66BC1708A89%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to