Failed to open config file '/dev/fd/63', error: No such file or directory for wpa_supplicant
Quoting the ArchLinux wiki:
Note: Because of the process substitution, you cannot run this command with sudo - you will need a root shell.
You should be able to use su -c
under sudo
like so:
$ sudo su -c 'wpa_supplicant -D nl80211,wext -i wlp4s0 -c \
<(wpa_passphrase "some ssid" "password")'
Process substitution <(…)
creates a pipe, uses /dev/fd
to give a path that's equivalent to the file descriptor where the pipe is, and passes the file name as an argument to the program. Here the program is sudo
, and it passes that argument (which is just a string, as far as it's concerned) to wpa_supplicant
, which treats it as a file name.
The problem is that sudo closes all file descriptors except for the standard ones (stdin=0, stdout=1 and stderr=2). The pipe of the process substitution is on another descriptor, which gets closed, so when wpa_supplicant
tries to open it, it finds a file that doesn't exist.
If your sudo policy allows it (closefrom_override
option enabled), you can tell it not to close file descriptors. But this is usually not the case.
sudo -C 64 wpa_supplicant … -c <(wpa_passphrase …)
Alternatively, since you aren't using standard input, pass the data there.
wpa_passphrase … | sudo wpa_supplicant … -c /dev/stdin
Alternatively, run a shell from sudo and put the process substitution there. Take care with quoting if the command contains special characters.
sudo bash -c 'wpa_supplication … -c <(wpa_passphrase …)'