Honchar Denys
Honchar Denys

Reputation: 1518

How to create a linux user using nodejs

I have seen npm adduser, but i can figure it out how to manage this inside mine code. What i have to do is to create new user from nodejs server code inside linux server, and change chmod and chown of that user and folders it content.

Upvotes: 3

Views: 3298

Answers (1)

Troy
Troy

Reputation: 68

Use child_process.execFile to execute /usr/sbin/adduser, /bin/chmod and /bin/chown

Otherwise you can use exec from npm if your version of nodejs doesn't have child_process.execFile

Upvotes: 1

Related Questions