You can only setuid() to your own ID unless you are running as root. That is why it works for foo and root but not bar.
~Ryan On Tue Nov 18 2014 at 1:39:02 PM mark edwards <[email protected]> wrote: > > hello all - first time posting. > > i am trying to run node.js from an account called "foo" and wish to write > into an area in the bar.com area: > > /home/bar.com/public_html/openDirectory/ > > i am trying to use mkdirp and am getting the following error: > > process.setuid(555) ; // 555 is foo's UID > mkdirp( '/home/bar.com/public_html/openDirectory' , function(err) { > > > { [Error: EACCES, mkdir '/home/bar.com/public_html/openDirectory'] > errno: 3, > code: 'EACCES', > path: '/home/bar.com/public_html/openDirectory' } > > > mkdirp works fine for me when i run as root or when i write into foo's > area, but when i try to mkdirp in another users area, i get the EACCESS > error. > > the /home/bar.com/public_html/openDirectory area is set up with 777 > protection: > > drwxrwxrwx 1 bar.com bar.com 4096 Nov 18 12:34 openDirectory > > i was tempted to look into seeing if i could temporarily grant the node > process root privilege, but wanted to run the issue by some others first. > > any suggestions for a first-time posting? > > -- > 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/0805884f-976e-4e36-a818-7c15a6fa26ab%40googlegroups.com > <https://groups.google.com/d/msgid/nodejs/0805884f-976e-4e36-a818-7c15a6fa26ab%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAGjmZGym9575ukk5vbaEF2VTLM0NdriGxCJkSMF2fYCw7YFi1A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
