Questions tagged [unix-sockets]
The unix-sockets tag has no usage guidance.
111
questions
0
votes
1
answer
29
views
Unix-domain Socket
I'm trying to set my server up and came across some troubles related to Unix domain sockets. I don't have so much experience with Unix, despite the stack for web development: Apache, PHP and SQL. I ...
4
votes
1
answer
63
views
What does SCM mean in unix sockets context (SCM_RIGHTS etc.)?
From man 7 unix
SCM_RIGHTS
Send or receive a set of open file descriptors from another
process. The data portion contains an integer array of the file
descriptors. The passed file descriptors ...
0
votes
0
answers
9
views
umask ACLs and socket permissions
I looked at the answer here How to set default file permissions for all folders/files in a directory?
And set the acls using setfacl
getfacl: Removing leading '/' from absolute path names
# file: run/...
0
votes
0
answers
35
views
How to allow the docker container to reach host's X11 socket without --net=host?
The old trick, using '-v /tmp/.X11-unix:/tmp/.X11-unix' to allow to use the host container no longer works.
I could make it work using '--net=host', but that makes the guest use the whole net ...
0
votes
0
answers
88
views
How to create a .sock file for unix_stream
I am new to this socket programming in linux I want to send a log file i.e eve.json This file is provided by suricata and they have already defined some setting in their configuration yaml to send ...
0
votes
1
answer
57
views
Do unix domain sockets support reuse?
Do unix domain sockets support reuse?
Lots of conflicting information about this online. I suspect a lot of it is just outdated, but I'm no expert.
Do I ProxySet enablereuse=on if my handler is a ...
1
vote
1
answer
158
views
Interacting with Unix Socket found in lsof
I found a Unix socket being used in the output of the lsof command:
COMMAND PID TID TASKCMD USER FD TYPE DEVICE SIZE/OFF NODE NAME
screen 110970 ...
0
votes
0
answers
31
views
How can I guess server socket type
I try to connect to my UNIX-socket server using openbsd-netcat, but have an error:
connect(): Protocol wrong type for socket
My socket type is SOCK_SEQPACKET, and it seems that nc tries to open it as ...
2
votes
1
answer
88
views
Why does socat fail at proxying X11 where ssh succeeds?
I am investigating how to write a simple X11 unix-socket-based proxy. I have tried various standard applications, as well as written my own code, but I am getting wildly variable results. What's ...
0
votes
1
answer
118
views
How can I target an X window to a secondary monitor? (and know what it is called in order to do that)
I have two monitors connected (one HDMI, one DVI) connected to an Nvidia GT710 GPU on my linux box.
When I am logged in to my box over ssh, if I run xeyes it will always run on the same screen.
I ...
0
votes
1
answer
765
views
unix domain socket permissions and umask integration between root and non root users
I'm trying to understand the permissions of a unix domain socket, when using an existing file, umask changes are required as well as the dir permissions.
If I create a world readable dir as root and ...
1
vote
0
answers
75
views
How to listen the requests sent to a unix socket
I'm learning docker and wanted to see the API commands sent by the client to the docker server/engine. I know that the communication between the two processes happens via /var/run/docker.sock. Is ...
1
vote
0
answers
217
views
What does 'Reached target Sockets' mean and what are possible fixes?
I have golang web application which runs by systemd daemon in a Debian Server. I've noticed that sometimes myapp stops while I see a message like this in syslog:
Aug 20 07:34:20 myapp systemd[29414]: ...
0
votes
0
answers
43
views
apt-daily.service seems to interfere with Unix sockets
We have an embedded device with Debian 9 that has been running for over a year without issues until recently.
We have a process that acts as an aggregator and communicates every second with several ...
0
votes
1
answer
33
views
"Holding" a socket open too long causes a new one to spawn
I am connecting to a socket via nc -U:
user@node:~$ sudo nc -U service\@name.18822.sock
user@node:~$ xmpp.status
user@node:~$ connected
If I "hold" this connection open too long, it will ...
0
votes
0
answers
320
views
Problem Accessing UNIX sockets remotely via SSH tunnel
I'm trying to use a TCP port to connect to a MySQL unix domain socket on a remote machine. I have removed networking on the mySQL server to harden it.
The SSH tunnel looks like this:
MyPC <---------...
3
votes
1
answer
289
views
Possible scenarios for Unix domain sockets interruption
When using TCP & UDP sockets, there are many scenarios which cause connection interruption (slow connection, network reset, etc).
Is there any possible situation which an unix domain socket ...
4
votes
1
answer
637
views
How can I use GPG agent forwarding over ssh when systemd owns the remote sockets?
I'm trying to follow these guides and answers
https://wiki.gnupg.org/AgentForwarding
https://superuser.com/questions/161973/how-can-i-forward-a-gpg-key-via-ssh-agent
https://gist.github.com/...
1
vote
0
answers
141
views
socat bidrectionally with a shell script. echo, read, then hand off to socat
There is a VMM which doesn't conform to the the standard VSOCK implementation: Firecracker
For each guest it creates a v.sock unix socket file
The ordinary VSOCK-CONNECT:cid:1234 then becomes:
UNIX-...
5
votes
0
answers
227
views
AF_UNIX: Using recv() to receive a message sent with sendmsg()
The function prototype for the sendmsg() function is as follows:
ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags);
and the msghdr struct is such:
struct msghdr {
void *...
-1
votes
1
answer
65
views
Why systemd says it's dependency system should be used only sparingly?
From systemd.unit(5) man page:
Note that while systemd offers a flexible dependency system between units it is recommended to use this functionality only sparingly and instead rely on techniques such ...
4
votes
1
answer
1k
views
hostnamectl command causes Failed to create bus connection: No such file or directory
I'm following this guide and I'm running into issues.
https://www.tecmint.com/initial-ubuntu-server-setup-guide/
I am trying to create a linux machine in Ubuntu in wsl2 and then rename it using ...
0
votes
1
answer
436
views
How to use unix domain socket for tor socks
I am trying to setup a unix socks socket for tor usage instead of port 9050 in the hopes to gain a tiny bit of performance. However I am getting the below error:
Oct 21 11:53:54 HOSTNAME Tor[992986]: ...
2
votes
1
answer
867
views
What happens when two processes listen on the same Berkeley/Unix [file] socket?
What happens when I set up two processes to listen to the same Berkeley socket?
Do messages get routed to both? Neither? One of the two? If so, how?
Concretely, I can start two gunicorn processes with ...
4
votes
1
answer
907
views
/proc/[pid]/fd/[0, 1, 2]: No such file or device - even though file exists
I'm trying to access a process' stdio streams from outside its parent process. I've found the /proc/[pid]/fd directory, but when I try
$ cat /proc/[pid]/fd/1
I get a No such file or device error. I ...
1
vote
0
answers
271
views
Can systemd be used as an inetd/xinetd replacement without being an init?
Can systemd be configured (in runtime or compile time) to serve as a simple process supervisor, not as /sbin/init?
If yes, are there tutorials and other documentation to follow to make customized non-...
0
votes
2
answers
893
views
Does every socket have its own buffers to send/receive messages?
I'm developping a C application that make extensive use of sockets.
My doubt is: Does every socket that I create have its own buffers to send and/or receive messages from other sockets?
In other words,...
0
votes
1
answer
178
views
what will happen if receiver unable to handle data velocity through socket?
I have two processes P1 (sender) and P2 (receiver). P1 uses unix-domain-socket (UDS) to send data to P2. what will happen if P1 sends data at the rate of 100 messages/second and P2 is capable to ...
0
votes
1
answer
1k
views
Is there a command to list all abstract unix sockets currently open?
Is there a command or system call for listing all the abstract unix sockets currently open?
Update: It was suggested that I use netstat -x, which theoretically works, but does not list the names of ...
0
votes
1
answer
130
views
Are socketpairs useable as signal-safe buffers?
I am thinking on a way of communication between signal handlers and the main program. Note, I use mosly non-blocking signals (a new signal can arrive even while a signal handler is executed), so I am ...
1
vote
1
answer
254
views
Stop child services when systemd socket connection closes
I'm trying to launch a meta-service remotely through a socket. Requirements:
The socket should start the meta-service when a connection is established
The meta-service should start all child (Wants=)...
1
vote
1
answer
1k
views
How to get notified when the other end of a socketpair is closed?
I have a parent process (client) talking with a child process (server) over Unix Domain sockets (aka IPC Sockets).
The sockets are created using socketpair() and are of type datagram.
I use ...
4
votes
2
answers
2k
views
Unix domain sockets for non-root user
I work on the application that uses Unix domain socket for IPC. The common way as I know is to place the socket file inside /var/run. I work with Ubuntu 18.04 and I see that var/run is a symlink for /...
6
votes
1
answer
2k
views
Display webpage with unix domain socket
Is there a way to serve a webpage from a locally running tcp server listening on a unix domain socket instead of localhost:<port>?
something like:
file:///tmp/webpage.sock
my only real ...
0
votes
1
answer
428
views
cannot find screen session I detached from
I am running a program on Unix server and I am mindful that I detached the screen and logged out of the server. Later I ssh'd back in and tried to reattach but I just cannot find my screen.
In fact ...
0
votes
0
answers
74
views
Connect docker-container with other container by unit-socket
I'am trying to connect to containers by unit-socket/
docker run -d -v /var/lib/docker/overlay/[container_id]/var/run/postgresql/.s.PGSQL.5432:/socket_volume/.s.PGSQL.5432 -p 50000:8080 my_repo/...
3
votes
1
answer
728
views
Binding a AF_UNIX to any existing file?
Can we bind a Unix domain socket to any random existing file ?
If no, how do you recognize a file that is used by a socket ?
2
votes
0
answers
829
views
Security issues for passing credentials over a UNIX socket
UNIX sockets often have a mechanism to authenticate their peer processes. However, there is a requirement for care in order to avoid confused deputy attacks.
Linux, for example, has two ways to pass ...
0
votes
0
answers
52
views
How to read data from one userspace app to another userspace process
From userspace application I read some data using IOCtl from kernel driver synchronously. Now Iam planning to move the driver to userspace. Is there a way for my userspace app to read some data from ...
1
vote
1
answer
582
views
Deleting the files from a SFTP server based modified time (SSH not enabled )
Need to delete the files from a sftp remote server based on last modified time .Files which are older then 30 days no need to keep in server .I have tried ls -lt ,but how to copy it to local machine ...
0
votes
1
answer
465
views
How can a client talk to another client using unix domain sockets?
Using bash we might have something like this with netcat:
nc -lk -U /my/fifo | while read line; do
# line => {"client_id":123}
done;
clients send data like this:
echo '{"client_id":123,"data":...
1
vote
1
answer
2k
views
Sending data to Unix socket failing unless proxied with socat via UDP
I'm trying to debug why data isn't being sent over a Unix Domain Socket.
I have 2 applications which should be communicating over a UDS but aren't.
To test I've done the following:
Using socat, I ...
4
votes
2
answers
2k
views
Unix Domain Socket bind, reuse address
If I bind() an AF_INET socket (for a TCP connection), then later close() it, next time I run my program, I may have issues, since despite the close(), the kernel can still have the resources ...
0
votes
2
answers
340
views
Can one processes have a descriptor that is non-blocking while another process have a descriptor referencing the same file/socket that is blocking?
I am more interested in sockets than regular files, but basically I want to know whether one process can "see" a socket as blocking where another process can see it as non-blocking. I am guessing yes,...
2
votes
2
answers
4k
views
How many connections can there be between two Unix domain sockets?
From APUE:
17.3 Unique Connections
A server can arrange for unique UNIX domain connections to clients
using the standard bind, listen, and accept functions. Clients
use connect to ...
1
vote
2
answers
179
views
Must an application-layer protocol exist for communication between any two programs using sockets?
When any two programs, no matter how simple or complicated, communicate by internet domain sockets (or Unix domain sockets), does it necessarily imply that there is an application-layer protocol ...
1
vote
0
answers
2k
views
socat - UNIX-LISTEN and TCP-LISTEN in one command
Is it possible, to open a tcp port and a socket with one process/command?
socat UNIX-LISTEN:/var/run/mysqld/mysqld.sock,fork,user=mysql,group=mysql,mode=777 TCP:123.123.123.1:3306
combined with:
...
4
votes
1
answer
1k
views
Forward abstract unix socket over SSH?
I've discovered that OpenSSH is capable of forwarding UNIX sockets like this:
ssh -R /var/run/program.sock:/var/run/program.sock
My question is whether this extends to abstract unix sockets too.
I'...
0
votes
1
answer
2k
views
Detect unix domain socket deletion?
Assume that you have an application that upon startup creates a unix domain socket and starts listening to it.
Then any subsequent instance of the application connects to that socket, passes data to ...
1
vote
1
answer
3k
views
It is possible to traceroute without touching ICMP?
I often run into a situation where I want to traceroute an IP without root or NET_RAW cap in Linux.
I have attempted to send a UDP packet with a small TTL but no ttl error is emitted at all. It seems ...