Questions tagged [unix-sockets]
The unix-sockets tag has no summary.
139 questions
0
votes
1
answer
69
views
Do posix functions like getpeername or getsockname completely rewrite their buffers?
I am new to socket programming & I have realized that most posix functions from libc require that you pass a buffer & a length. While I can understand this helps the functions to understand ...
2
votes
1
answer
111
views
What is the cost of listening on ports?
If you would open a listening socket on every possible TCP/UDP port (so thousands in total), without actually using them, what would be the cost in terms of performance?
Is it merely an administrative ...
0
votes
1
answer
136
views
Configure mpd to only start a UNIX socket
Running mpd without any bind_to_address in the config starts a working UNIX socket at /run/user/1000/mpd/socket but also starts a network socket at 0.0.0.0:6600 / [::]:6600.
I would like to have only ...
0
votes
1
answer
66
views
Why syslogd receives the message and not journald?
I have tried to log into journald using logger.
logger test, journalctl |grep test does not show any output. The message does not reach journald even though it listening and logger is writing (I ...
0
votes
0
answers
99
views
Run RPCBind on a docker container with the socket enabled (for port 111)
I'm trying to dockerize a rpc application I made using C lang and rpcgen, I have the byte executable and everything, I tried a lot of docker os image like ubuntu 22.04/ debian and so on, the ...
2
votes
1
answer
355
views
What process can remove an entry from a router NAT table?
I have just been watching a video which explains UDP holepunching.
https://www.youtube.com/watch?v=GfRLNg6DOnI
In this video, some processes which create entries in a router NAT table are explained.
...
0
votes
0
answers
617
views
Accessing Docker Unix Socket from a Podman Container on a Remote Server (SSH)
I'm trying to access a Docker Unix socket on a remote server from within a Podman container (offen/docker-volume-backup).
I've (root-)mounted the entire root filesystem of the remote server using ...
0
votes
0
answers
224
views
Weird apparmor unix socket denial for sudo
I have a custom SSH server written in go that wraps commands called by the client in apparmor.
One of the profiles confines sudo and what commands it can call. It started failing on a proxmox backup ...
0
votes
1
answer
720
views
Communicate with UNIX sockets opened by dbus-daemon
I'm trying to learn how to interact with message buses under Linux, and doing so with shell commands that doesn't involve utilities packaged under dbus-*. For this instance, I want to understand how ...
0
votes
0
answers
41
views
Multipass IP resolution failing
I am trying to deploy a basic Flask application on my Ubuntu VM through multipass. However, I cannot access the website through the IP address from the host OS on the browser.
flask run --host=0.0.0.0
...
11
votes
4
answers
1k
views
How can I secure unencrypted credential files, for programs that assume them (like gmi/lieer)?
Brief
Q: How can I cryptographically secure a credentials file that is stored on disk as plaintext?
Or, rather: how can I avoid storing credentials like those for Gmail and other API keys on disk? ...
3
votes
0
answers
197
views
Understanding piping to a unix domain socket in the background
I have a Debian 12 (bookworm) host where I run three VMs using QEMU / KVM. To simplify VM management, each VM has a QEMU monitor socket. These sockets are /vm/1.sock, /vm/2.sock and /vm/3.sock. Among ...
-1
votes
1
answer
468
views
syslog logging driver giving the error protocol wrong type for socket
I have a service defined via docker compose (see definition below). When I tried to start this service via docker-compose -f up --wait -d my_service, I get the error
Error response from daemon: ...
0
votes
1
answer
98
views
Unix domain socket frame structure
How does a unix domain socket packet look like? Is it like a TCP/IP packet which have an ethernet header, an IP header and a TCP header? How do they look like in unix domain socket?
2
votes
1
answer
777
views
Proxy between UNIX socket with socat
I used socal to create a proxy server between 2 UNIX sockets: /var/a.sock , /var/b.sock
client -> /var/a.sock -> MY_COMMAND -> /var/b.sock -> MY_COMMAND -> /var/a.sock ->client.
The ...
0
votes
1
answer
452
views
What is a port?
I have been running an Apache web server for numerous years and have been using ports as a medium to serve requests.
Recently, I began using Unix sockets to serve MySQL requests. The function of Unix ...
1
vote
1
answer
97
views
Unix socket in /tmp turns into directory on reboot
I run an Ubuntu based server on raspi (6.5.0-1015-raspi #18-Ubuntu). On this system, I have knxd running, exposing a KNX bus to my server, and then Home Asssitant in a docker container. knxd and ...
0
votes
1
answer
244
views
How can I find out what so_type an existing unix socket has in macOS?
In linux we can run ss -x or lsof -U +E and we can see what type unix socket has. But in macOS there is no ss or we can run lsof -U which only shows TYPE - unix, but I would like to know with some ...
1
vote
0
answers
169
views
pcscd unix domain socket forwarding
I want to forward smart card request to a pc where smart card is connected but am unable to forward socket via ssh source : 10.169.213.211(server) destination : 10.169.41.124(client) what I attempt to ...
0
votes
1
answer
410
views
Delete only processed files from SFTP
We have 1000 files in SFTP server and are able to process in local server using linux script and it takes 10 mins, after processing we wants delete only processed files.
Mean time we my get some new ...
1
vote
0
answers
1k
views
prometheus node exporter sockstat
I'm looking for the meaning of the node_sockstat_TCP_mem_* metrics.
The output of the node exporter describes them as follows:
# HELP node_sockstat_TCP_mem Number of TCP sockets in state mem.
# TYPE ...
1
vote
1
answer
303
views
ss doesn't display socket info related to the process opening SOL_SOCKET
I run a python code inside docker container performing the following calls
import socket as s,subprocess as sp;s1=s.socket(s.AF_INET,s.SOCK_STREAM);
s1.setsockopt(s.SOL_SOCKET,s.SO_REUSEADDR, 1);s1....
1
vote
0
answers
319
views
nginx and workers and linux tcp sockets/lsof
I started nginx with just a single worker.
ps --forest -fC nginx
UID PID PPID C STIME TTY TIME CMD
root 3615889 10118 0 14:18 ? 00:00:00 nginx: master ...
0
votes
0
answers
27
views
Linux mkfifo not writable by other users [duplicate]
I have a program that creates a socket and waits that someone writes on it, I would like to write with another users but even after changing permissions i cant.
mkfifo -m 777 /tmp/socket
running the ...
0
votes
1
answer
775
views
Writing to unix socket file as fast as possible
I'm trying to write with perl to a unix socket file as fast as possible but failing on full message buffer. I tried autoflush and manual flush without success.
use IO::Select;
use IO::Socket::UNIX;
...
0
votes
1
answer
418
views
how to remove file 0= file which has srw permission
How can I remove below file?
srwxrwxrwx 1 patroh root 0 Aug 8 16:11 0=
The user patroh is myself. The rm command won't work - it doesn't give any error when I execute rm 0.
I am not sure ...
0
votes
0
answers
573
views
Socat serial to tcp for authorized users
Hello everyone I hope you doing well
I have a raspberry pi and I kind need a serial port server which can access from internet
Now I use socat command like bellow on my raspberry and from putty on ...
0
votes
1
answer
102
views
EPROTOTYPE (_SIGN 41 ) while creating raw socket() in MINIX 3
The following is my code snippet that is producing EPROTOTYPE error, aka, Protocol Wrong Type for Socket.
I checked for the headers in /usr/include in MINIX 3, sys/socket.h contains definitions for ...
2
votes
1
answer
2k
views
Can a single unix domain socket connect to multiple peers simultaneously?
Since this is the socket that syslog's /dev/log is symlinked to, I expect there is at least one listening socket from systemd-journald, and possibly some additional connected ones, with different &...
0
votes
0
answers
792
views
get data from socket on port
I have a specific service that sends data on port 5555. I need to open socket on shell unix to listen on this port and print output on shell. Service is deployed as docker container.
So, I run ...
1
vote
1
answer
895
views
Is 2 pipes more expensive than 1 socketpair?
Suppose I want to launch a co-process and attach its standard input and output to the main process, what we have here are 2 options:
call pipe(2) and create 2 pipes, and attach them separately to the ...
3
votes
1
answer
255
views
Detect presence of non-connected socket that holds the port (on Linux)
Test on Linux (particularly: Ubuntu 20.04 LTS, kernel 5.4.0): in Python:
from socket import *
s1 = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
s1.bind(('', 11001))
s2 = socket(AF_INET, SOCK_STREAM, ...
0
votes
1
answer
2k
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 ...
5
votes
1
answer
2k
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
2k
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
477
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 ...
5
votes
1
answer
7k
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
1
answer
799
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 ...
4
votes
1
answer
745
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
5k
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 ...
2
votes
1
answer
8k
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
951
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 ...
0
votes
1
answer
425
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
1k
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
1k
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 ...
7
votes
2
answers
4k
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
828
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
1k
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 *...
0
votes
1
answer
212
views
Why systemd says its 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 ...
5
votes
1
answer
3k
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 ...