Reputation: 87833
At this time, fs.chown
requires int
values for uid
and gid
.
So, what is the recommended way to get these int values from a UNIX-like system?
Should I read /etc/passwd
and /etc/group
directly?
That does not seem like the right way to do it...
Upvotes: 7
Views: 3075
Reputation: 22099
Just call chown
directly:
var exec = require( "child_process" ).exec;
exec( "chown user:group filename" );
Upvotes: 2
Reputation: 1897
You've probably solved it by now, but for future reference: the uid-number package is used by npm, so I think it can be safely assumed that it works (and it does for me).
Upvotes: 2
Reputation: 7172
I checked and found this: https://npmjs.org/package/getuid I haven't used it. caveat emptor.
Personally, I like looking these up in a configuration file that the user supplies :)
-daniel
Upvotes: 0