Repository navigation
net.createConnection needs an option to set the permissions of a named pipe #30823
Description
Activity
No new API or option is necessary:
const filename = '/tmp/collect.sock'; server.listen(filename, () => { fs.chmod(filename, 0o666); });
Node.js wouldn't be able to do any better because the UNIX APIs for creating a socket/named pipe don't let you set the permissions, it's always created with mode
0o666 & ~process.umask().- addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.netIssues and PRs related to the net subsystem.Issues and PRs related to the net subsystem.wontfixIssues that will not be fixed.Issues that will not be fixed.
on Dec 7, 2019 mkfifo is a wrapper around
mknod(2)but that doesn't create a socket, onlysocket(2)does.So if you are using mknod to create a Unix socket
Stop right there: you don't use mknod() to create UNIX sockets. Check
man 2 mknod, you use it to create character and block devices, the files that usually live under/dev.a Unix socket, aka pipe or named pipe or fifo
Those are all different things and covered by different system calls.
Node.js does not use mkfifo(2)... I'm sorry but I don't know of a nicer way to phrase this: you're arguing from a position of ignorance here. Please educate yourself on the subject before you go on.
I already told you node uses
socket(2)and a quick grep would have informed you that deps/uv/src/unix/pipe.c is the code you're interested in.And call me weird, but I always check the source code before I start making specific suggestions - that avoids the kind of pointless back-and-forth we just witnessed.
I think you may need to read more closely; that's
F_GETFL, notF_SETFL. :-)
13.3.0
Linux
Debian
If I were to create a "server" for IPC using a named pipe like:
There are permission issues if I am accessing that named pipe from a process which has a different linux profile permission mask than the user which started the server.
It would be really nice to just have the ability to set the permissions on the named pipe file when creating the server with
net.createServer().You get something like this when trying to connect to the named pipe in a process ran by a user with different permissions on his account.