News for hackers. Stuff that matters.
Re:Umask setting is ignored by npm for some directories by nathancahill on Wednesday October 26, 2016 @12:24PM (#12797804)
Reminds me of PHP back in the day. Doesn't work? chmod -R 777 /var/www
Re:Umask setting is ignored by npm for some directories by ars on Wednesday October 26, 2016 @12:47PM (#12798079)
That has nothing to do with PHP and everything to do with that the webserver runs as a different user than the creator of the files.

Unless you have root it's rather difficult to make a directory that the webserver can write to.

It's not specific to PHP, except that PHP is used for web scripting.

The correct way to do it, if you don't have root is:

Make a directory 777 (yes, you do need to). Have the webserver create a subdirectory owned by the webserver. Change the parent directory away from 777 to 755 or 775.

Double check that no one else created something in there while it was wide open.

Be aware that ALL users on that machine who can run web scripts have access to that directory.

An even better way is with mpm-itk

Re:Umask setting is ignored by npm for some directories by mst on Wednesday October 26, 2016 @12:52PM (#12798134)
freenode #perl still periodically has to talk somebody trying to get a CGI script running out of using 777 to avoid having to figure out permissions properly.
Re:Umask setting is ignored by npm for some directories by rhizome on Wednesday October 26, 2016 @01:05PM (#12798261)
It's an evergreen topic, I've seen this in so many contexts in almost 20 years in IRC help channels that it's a shibboleth for rookie status in configuring systems. Not only that, but it's a communicable weakness in that it's always passed on from person to person: if you only taught yourself using Google, it's actually hard to find 777 as advice. If you see an SO comment/answer recommending 777, it's invariably downvoted into oblivion.

This increased when devops came on the scene, and it was probably one of the first things that made me conclude that devops was about pushing sysadmin skills on unprepared developers. /rant

Re:Umask setting is ignored by npm for some directories by kuschku on Wednesday October 26, 2016 @03:20PM (#12799562)
It’s also an interesting task: How do you configure a folder so that two users, who are in no common groups, can read, write and execute everything? Even if the other user uploaded it with 700 set?
Re:Umask setting is ignored by npm for some directories by Ded7xSEoPKYNsDd on Wednesday October 26, 2016 @04:06PM (#12799975)
If there's really no way to run these processes as the same group at least, there's always ACLs:

    setfacl -m u:NON-OWNER:rwX,d:u:NON-ONWER:rwX,d:u:OWNER:rwX DIR
(Allows NON-OWNER to read, write, execute if already executable for anyone to that directory, and allows NON-OWNER and OWNER to do the same for newly created files.)
Re:Umask setting is ignored by npm for some directories by kuschku on Wednesday October 26, 2016 @04:56PM (#12800467)
I’m not sure that solves the issue of a user (user:user) uploading and creating files via SFTP, but www-data:www-data having to execute, read, and modify them.
Re:Umask setting is ignored by npm for some directories by Ded7xSEoPKYNsDd on Wednesday October 26, 2016 @05:29PM (#12800796)
It works pretty well for me, to get Web DAV access to my files on my NAS.

The default ACLs make sure that any newly created files can be accessed by both users.

Re:Umask setting is ignored by npm for some directories by nolok on Wednesday October 26, 2016 @12:29PM (#12797863)
Because that's wasn't PHP, that was (and still is) shitty devs