
Using netcat is also not an option, as it rejects the UDP broadcast: $ echo -e "\xff" | nc -u 255.255.255.255 4000 To the best of my knowledge, this implementation does not allow to send UDP datagrams to the broadcast address, as this requires setting an SO_BROADCAST flag to the socket before sending. Writing to /dev/udp uses bash's built-in socket implementation.

Previous answer: You have to resort to socat: $ echo -e "\xff" | socat - UDP-DATAGRAM:255.255.255.255:4000,broadcast Short answer: bash can currently not do that.
#Netcat windows access denied Patch#
Your best bet would be to send a patch to current bash maintainers or the appropriate mailing list, have it included in the official releases, then wait until the rather modern bash version in your NAS gets updated to an even more modern version including your feature. lib/sh/netopen.c shows that bash opens a UDP socket ( SOCK_DGRAM) then directly tries to connect without looking at the ip address to determine whether it would make sense to set specific socket options (in your case SO_BROADCAST). You can not do that using the latest official release of bash (currently 4.3.30 according to this page). Sh: /dev/udp/255.255.255.255/4000: Permission deniedĮdited following OP's clarification on the use case: GNU bash, version 4.1.11(2)-release (arm-ffp-linux-uclibc) Tested failing too on Bash from Conceptronic CH3SNAS (a NAS with 2 HDDs) installed via Fun_Plug: sh-4.1# bash -version

Why is this happening and how could I solve it? GNU bash, version 4.3.11(1)-release (arm-unknown-linux-gnueabihf)ĭoing this via direct character sending to NIC instead of by using netcat or socat could be useful for some routers or embedded devices (like NAS) that have a rather modern Bash version, but don't allow (or it is awkward to achieve) installation of extra tools.

GNU bash, versión 4.3.11(1)-release (i686-pc-linux-gnu)Īnd Ubuntu for RaspBerry Pi 2: bash -version I am trying to send characters directly to the network stack as explained in this thread.Įven when the process work OK under CygWin (Windows), the same lines do fail on Ubuntu v14.04: sudo echo -e "\xff">/dev/udp/255.255.255.255/4000
