Node: How to modify the permissions of namedpipe

Created on 3 Nov 2016  路  7Comments  路  Source: nodejs/node

How to modify the permissions of namedpipe

In the windows cmd to use the super administrator to start the code

server.js


var http = require('http');
var fs = require('fs');
http.createServer(function (req,res) {
    res.end('Hello World\n');
}).listen('\\\\.\\pipe\\daemon.rpc.ddv.sock');


fs.access('\\\\.\\pipe\\daemon.rpc.ddv.sock',  fs.constants.X_OK| fs.constants.R_OK | fs.constants.W_OK, function(err) {
    console.log(err)
  console.log(err ? 'no access!' : 'can read/write');
});

If I use the administrator to start the service, it is not the administrator of the cmd does not have access to the pipeline, how do

Under Windows
In the windows sys cmd to use user permissions to start the code

test.js


var http = require('http');  


var options = {  
    socketPath: '\\\\.\\pipe\\daemon.rpc.ddv.sock',    
    path: '/',  
    method: 'GET'
};  
var req = http.request(options, function (res) {  
    console.log('STATUS: ' + res.statusCode);  
    console.log('HEADERS: ' + JSON.stringify(res.headers));  
    res.setEncoding('utf8');  
    res.on('data', function (chunk) {  
        console.log('BODY: ' + chunk);  
    });  
});  req.on('error', function (e) { console.log('problem with request: ' + e.message);  });  req.end();  

In the windows cmd use the administrator can get normal results, non-administrator on the error "problem with request: connect EPERM \. Pipe \ daemon.rpc.ddv.sock"

question windows

Most helpful comment

It looks like you don't have permission to open that pipe when running as a non-administrator.

On another note, please don't flood the issue tracker. Most of us are volunteers, so our time is somewhat limited.

All 7 comments

That question now how to do? No one has been answered

Why is this posted no reply? Can you help me? thank you very much! Node developers generally have time to see?

This is clearly a node in Windows did not give a solution to the bug, why no one answered it

It looks like you don't have permission to open that pipe when running as a non-administrator.

On another note, please don't flood the issue tracker. Most of us are volunteers, so our time is somewhat limited.

@evanlucas answered your question so I'm going to go ahead and close this again.

@bnoordhuis But this answer does not solve this problem

Then you should explain why it doesn't work for you and what you see instead. If you thought we are all mind readers that can pluck the answers straight from your brain, newsflash, we're not.

Also, since your question is a support issue more than a bug report or a feature request, https://github.com/nodejs/help/issues is a better place to ask it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jmichae3 picture jmichae3  路  3Comments

cong88 picture cong88  路  3Comments

danialkhansari picture danialkhansari  路  3Comments

mcollina picture mcollina  路  3Comments

willnwhite picture willnwhite  路  3Comments