mkdirp and EASSES

39 views
Skip to first unread message

mark edwards

unread,
Nov 18, 2014, 4:05:25 PM11/18/14
to nod...@googlegroups.com

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:


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',


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?

Ryan Graham

unread,
Nov 18, 2014, 7:58:24 PM11/18/14
to nod...@googlegroups.com
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
--
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 nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/0805884f-976e-4e36-a818-7c15a6fa26ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages