Sorry , I didn't understand the question in the first mail, maybe this:
exec('id -u username', function (err, stdout) {
var user_id = stdout;
process.setiuid(user_id)
}) ;
2013/11/8 Robert Steckroth <[email protected]>
> Hell ya, upstart is your friend, but I want to set the user to www-data in
> the nodejs script for development purposes as well.
> I can set the user with a process.setuid(uid) command but this
> requires knowledge of the UID of the user I need. I was hoping for
> a different/better solution than
> manually parsing the /etc/passwd file.
>
>
> On Fri, Nov 8, 2013 at 11:48 AM, José F. Romaniello <
> [email protected]> wrote:
>
>> I usually register my node.js servers as daemons (services) with upstart.
>> Upstar scripts can have "setuid" :
>>
>> http://upstart.ubuntu.com/cookbook/#setuid
>>
>> To run a command from the CLI as another user you can use "sudo -u user
>> command" eg: sudo -u user node server.js
>>
>>
>>
>>
>>
>>
>>
>> 2013/11/8 Robert Steckroth <[email protected]>
>>
>>> I wish to switch my nodejs server user to a different one. I can find
>>> the current user and UID but not others. What is the best way to switch the
>>> process uid to a different one, e.g. www-data? This is probably a Linux
>>> only question..
>>>
>>> --
>>> <surgemcgee> Systems/Software Engineer
>>>
>>>
>>>
>>> --
>>> --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines:
>>> 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 post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>
>>> ---
>>> 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].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>> --
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> 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 post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>> ---
>> 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].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> <surgemcgee> Systems/Software Engineer
>
>
>
> --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> 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 post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> 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].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
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].
For more options, visit https://groups.google.com/groups/opt_out.