278
votes
Accepted
Allow non-root process to bind to port 80 and 443?
I'm not sure what the other answers and comments here are referring to. This is possible rather easily. There are two options, both which allow access to low-numbered ports without having to elevate ...
- 10.2k
166
votes
Accepted
Can cURL send requests to sockets?
The feature was added in curl 7.40.
curl --unix-socket /var/run/docker.sock http:/images/json
Another example:
curl --no-buffer -XGET --unix-socket /docker.sock http:/events
Which specifies the ...
- 1,819
84
votes
Accepted
Why was port 80 chosen as the default HTTP port and 443 as the default HTTPS port?
The Internet Assigned Numbers Authority (IANA) is a department of ICANN, a nonprofit private American corporation that oversees global IP address allocation, Domain Name System (DNS), well-known ports ...
- 16.9k
47
votes
Allow non-root process to bind to port 80 and 443?
I have a rather different approach. I wanted to use port 80 for a node.js server. I was unable to do it since Node.js was installed for a non-sudo user. I tried to use symlinks, but it didn't work for ...
- 1,177
36
votes
Accepted
What is the difference and relationship between a process id and a port number?
To answer the question directly: there is no connection between the process ID and the port number. They enumerate entirely different things.
The PID identifies a process (eg a Firefox session: each ...
- 553
32
votes
Allow non-root process to bind to port 80 and 443?
Simplest solution : remove all privileged ports on linux
Works on ubuntu/debian :
#save configuration permanently
echo 'net.ipv4.ip_unprivileged_port_start=0' > /etc/sysctl.d/50-unprivileged-...
- 429
32
votes
Accepted
How to determine the socket connection up time on Linux
You can try the following:
get the PID (say $pid) of the program by adding the -p option to netstat.
identify the proper line in the /proc/net/tcp file by looking at the local_address and/or ...
- 20.9k
32
votes
Accepted
How does the OS tell whether an "Address is already in use"?
You are probably re-starting your program too fast, or the program is not closing
the socket.
Even after the socket is closed, Linux keeps the connection in limbo for
some time,
but will prevent any ...
- 429k
31
votes
Accepted
how to view haproxy status on the command line using a socket
I found the following to be useful
watch 'echo "show stat" | nc -U /var/lib/haproxy/stats | cut -d "," -f 1,2,5-11,18,24,27,30,36,50,37,56,57,62 | column -s, -t'
It will produce output as follows
...
- 12.6k
22
votes
Accepted
What is non-networked Unix domain socket?
It's a socket whose address is a filesystem path rather than some form of network address. For example, instead of connecting to an IP address:port such as 127.0.0.1:4567, the program will "...
- 399k
19
votes
Linux named sockets howto
Create a socket quickly in python:
~]# python -c "import socket as s; sock = s.socket(s.AF_UNIX); sock.bind('/tmp/somesocket')"
~]# ll /tmp/somesocket
srwxr-xr-x. 1 root root 0 Mar 3 19:30 /tmp/...
- 776
18
votes
Accepted
How to expose Linux socket file from Docker container (MySQL, MariaDB, etc.) to host
The problem is that bind mounts are for exposing something on the host to the container. So when you do this:
volumes:
- /srv/docker/sockets/mariadb.container.sock:/var/run/mysqld/mysqld.sock
You ...
- 3,905
17
votes
Why was port 80 chosen as the default HTTP port and 443 as the default HTTPS port?
The answer by jcbermu mentions that RFC 1340 (assigned numbers) had a run of unused ports from 374 to 512, and 443 is right in the middle.
assert https_port == (374 + 512) / 2 == 443
- 171
12
votes
What is the difference and relationship between a process id and a port number?
The PID is shown only so that you can identify the specific process doing the communication and is unrelated to the port number.
If you had multiple copies of one program running and they were all ...
- 86.7k
11
votes
Manually closing a port from commandline
You can close a listening socket using ss:
sudo ss --kill state listening src :1234
Where 1234 is your port number.
ss is part of the iproute2 package, so there is a strong change it is already ...
- 1,703
11
votes
Can I monitor a local unix domain socket like tcpdump?
// backup the socket
sudo mv /var/run/docker.sock /var/run/docker.sock.original
// use tcp port 8089 proxy the original socket
sudo socat TCP-LISTEN:8089,reuseaddr,fork UNIX-CONNECT:/var/run/docker....
- 121
10
votes
Accepted
Connect a M.2 (B & M) key SSD into a B socket
It should... a B&M module should work with either a B or M socket, this is by design.
The B interface provides x2 PCIe, SATA, USB 2.0 and 3.0, audio, UIM,
HSIC, SSIC, I2C, and SMBus support. ...
- 6,359
10
votes
What is the difference and relationship between a process id and a port number?
Process
What is a process?
A process is basically a copy of a program. So, if you run a program like Notepad multiple times, each specific time will get its own Process. A process uses resources, ...
- 15.1k
6
votes
Where is "unix:abstract=/tmp/dbus-KtyPDgWNin" socket file saved?
It's an "abstract" socket; it doesn't exist in the file system. This is a Linux-ism. See man 7 unix for more details.
- 254
5
votes
Accepted
Linux localhost sockets painfully slower than on Mac
Try to turn on TCP_NODELAY.
By default TCP uses Nagle's algorithm to collect small outgoing packets in order to send all at once as one big packet, which can have a detrimental effect on latency.
- 429k
5
votes
How to determine the socket connection up time on Linux
This questions was helpful to me, but I found using lsof instead of netstat let me avoid all the HEX stuff:
For a process ${APP} run by user ${USER}, the following returns all the open sockets to the ...
- 191
5
votes
Accepted
Is it bad practice to listen on 0.0.0.0? Why?
I decide then to deploy it configuring the address 0.0.0.0 to bind to
the service configured port and job done.
Will network administrators frown upon it?
It would be bad practice if it's not ...
- 22.6k
5
votes
Accepted
What is this socket/port/connector on my laptop?
That is a Kensington lock used for anti-theft purposes. It is attached by means of a cable from something stationary, such as a table, to the device. The cable will then lock at one end from the port, ...
- 341
4
votes
Where to put Unix sockets?
They are to be stored in /run/ according to the Filesystem Hierarchy Standard (FHS).
System programs that maintain transient UNIX-domain sockets must place them in this directory or an appropriate ...
- 143
4
votes
How to stop listening at Port 135?
I have same question.
TCP port 135 is shared by DCOM(based on RPC) and Raw RPC server component as a public entrance of TCP/UDP/NamedPipe transport layer which is chosen by each DCOM/Raw RPC server ...
- 588
4
votes
Determining what process has bound a port (without listening) on Windows
I had to do this exact thing today. Powershell can do it with Get-NetTCPConnection.
PS C:\WINDOWS\system32> Get-NetTCPConnection -LocalPort 53100
LocalAddress LocalPort ...
- 2,138
4
votes
Accepted
Close open sockets from crashed program
Sockets are finally closed by the Unix kernel; a crashed program is no different from a normal program exit w/o a close()/shutdown() call.
Your problem may have to do with the TIME_WAIT state of the ...
- 55.1k
4
votes
pfctl divert-socket in mac os?
Here are docs stating that the divert-packet option really exist:
the docs you're citing are written for OpenBSD.
Meanwhile Pf was originally written for OpenBSD indeed and Apple had it ported for ...
- 399
4
votes
How can I know what is preventing my socket to bind to localhost:50060-50959
If you face this issue on Win10 2004 that's because of an issue in this update, do the following:
netsh int ipv[46] set dynamic tcp start=49152 num=16384
reg add HKLM\SYSTEM\CurrentControlSet\...
- 141
4
votes
What is non-networked Unix domain socket?
Based on the context it means that docker is not accessible from outside the host (i.e. local and external network), but "only processes [on the same machine] with root permission or Docker ...
- 5,322
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
sockets × 268networking × 87
linux × 69
tcp × 49
port × 27
windows × 25
tcpip × 16
macos × 14
udp × 12
cpu × 11
unix × 11
windows-7 × 10
python × 8
mysql × 8
java × 7
ubuntu × 6
router × 6
apache-http-server × 6
socat × 6
wireless-networking × 5
motherboard × 5
ip × 5
firewall × 5
port-forwarding × 5
php × 5