unix-sockets

ss doesn't display socket info related to the process opening SOL_SOCKET

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.bind(("0.0.0.0",9001));s1.listen(1);c,a=s1.accept(); I’m trying to get info using ss and see the open sockets, but can’t get them docker run –rm –publish 9001:9001 -it –name python-app …

Total answers: 1

how to remove file 0= file which has srw permission

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 how I created this file? …

Total answers: 1

EPROTOTYPE (_SIGN 41 ) while creating raw socket() in MINIX 3

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 AF_INET and SOCK_RAW, and declaration for socket() while netinet/in.h contains the definition for …

Total answers: 1

Interacting with Unix Socket found in lsof

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 username 4u unix 0xffff91fe3134c400 0t0 19075659 socket The "DEVICE" column holds what looks like a memory address. According to the lsof …

Total answers: 1

Why systemd says its dependency system should be used only sparingly?

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 as bus-based or socket-based activation which make dependencies implicit, resulting in a both simpler …

Total answers: 1

How to use unix domain socket for tor socks

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]: Permissions on directory /var/lib/tor-shared are too permissive. Oct …

Total answers: 1

Display webpage with unix domain socket

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 motivation is to avoid port conflicts in the 2000-5000 range. Asked By: Alexander Mills || Source Yes It is easy …

Total answers: 1

How can I sniff unix dgram socket without having file path?

How can I sniff unix dgram socket without having file path? From that article, I realized that: a UNIX domain socket is bound to a file path. So, I need to sniff DGRAM Unix socket through the socat as mentioned here. But when I try to retrieve the path for this purpose, I find that …

Total answers: 1

SSH connect to a UNIX socket instead of hostname

SSH connect to a UNIX socket instead of hostname Short question: How do I connect to a local unix socket (~/test.sock) via ssh? This sockets forwards to an actual ssh server. The obvious does not work and I can’t find any documentation: public> ssh /home/username/test.sock “ssh: Could not resolve hostname: /home/username/test.sock: Name of service not …

Total answers: 3

What values may Linux use for the default unix socket buffer size?

What values may Linux use for the default unix socket buffer size? Linux documents the default buffer size for tcp, but not for AF_UNIX (“local”) sockets. The value can be read (or written) at runtime. cat /proc/sys/net/core/[rw]mem_default Is this value always set the same across different Linux kernels, or is there a range of possible …

Total answers: 1

OpenSSH not cleaning up the domain socket upon termination

OpenSSH not cleaning up the domain socket upon termination I have a local unix socket tunneled to another unix socket on a remote instance over SSH: ssh -N -L $HOME/my.sock:/var/run/another.sock however, when I terminate ssh gracefully (i.e. ctrl+C or SIGTERM), the $HOME/my.sock remains. It looks like this is not cleaned up properly. Is there an …

Total answers: 1

Can't start applications due to "Maximum number of clients reached" error

Can't start applications due to "Maximum number of clients reached" error After some period of time, I’m experiencing problems with starting applications, for example, Viber. $ /opt/viber/Viber QSqlDatabasePrivate::removeDatabase: connection ‘ConfigureDBConnection’ is still in use, all queries will cease to work. Maximum number of clients reached (Viber:1279): Gtk-WARNING **: cannot open display: :0 Skype $ skype …

Total answers: 3

Why is socket path length limited to a hundred chars?

Why is socket path length limited to a hundred chars? On Unix systems path names have usually virtually no length limitation (well, 4096 characters on Linux)… except for socket files paths which are limited to around 100 characters (107 characters on Linux). First question: why such a low limitation? I’ve checked that it seems possible …

Total answers: 2

Concurrently reading/writing to the same unix socket?

Concurrently reading/writing to the same unix socket? Is it OK for two or more processes concurrently read/write to the same unix socket? I’ve done some testing. Here’s my sock_test.sh, which spawns 50 clients each of which concurrently write 5K messages: #! /bin/bash — SOC=’/tmp/tst.socket’ test_fn() { soc=$1 txt=$2 for x in {1..5000}; do echo “${txt}” …

Total answers: 1

Do UNIX Domain Sockets Overflow?

Do UNIX Domain Sockets Overflow? When you create a UNIX socket using socat and send data to it, but do not have another socat instance connecting to that socket, what will happen then? What happens if you write massive amounts of data to a UNIX socket and never read it? Is there a buffer that …

Total answers: 1

Does Linux automatically clean up abstract domain sockets?

Does Linux automatically clean up abstract domain sockets? There’s a great answer on StackOverflow about providing a better lock for daemons (synthesized from Eduardo Fleury) that doesn’t depend on the common PID file lock mechanism for daemons. There are lots of good comments there about why PID lock files can sometimes cause problems, so I …

Total answers: 2

What happens with unix stream ancillary data on partial reads?

What happens with unix stream ancillary data on partial reads? So I’ve read lots of information on unix-stream ancillary data, but one thing missing from all the documentation is what is supposed to happen when there is a partial read? Suppose I’m receiving the following messages into a 24 byte buffer msg1 [20 byes] (no …

Total answers: 1

Connect with D-Bus in a network namespace

Connect with D-Bus in a network namespace I am using network namespaces such that I can capture network traffic of a single process. The namespace is connected through the “host” via a veth pair and has network connectivity through NAT. So far this works for IP traffic and named Unix domain sockets. A problem arises …

Total answers: 3

What is the meaning of the contents of /proc/net/unix?

What is the meaning of the contents of /proc/net/unix? On my Android device there is the file called /proc/net/unix who’s content does not conform to that of any standard linux distribution (which show the unix domain sockets.) First few lines: Num RefCount Protocol Flags Type St Inode Path 00000000: 00000002 00000000 00000000 0002 01 5287581 …

Total answers: 1