How to access Unix Domain Sockets from the command line?
nc -U </unix/socket>
almost in any Linux, BSD, MacOs.
You can use ncat
command from the nmap
project:
ncat -U /tmp/tbsocket1
To make it easy to access, you can do this:
# forward incoming 8080/tcp to unix socket
ncat -vlk 8080 -c 'ncat -U /tmp/tbsocket1'
# make a http request via curl
curl http://localhost:8080
You can also use socat
:
# forward incoming 8080/tcp to unix socket
socat -d -d TCP-LISTEN:8080,fork UNIX:/tmp/tbsocket1