wifi-password
wifi-password copied to clipboard
Didn't fetch my password with `sudo nmcli ...`, only with `nmcli ...`
Here's an example:
Your command from here:
m ~ % sudo nmcli -s -g 802-11-wireless-security.psk connection show $SSID | grep -q . && echo 'Password found'
m ~ %
Since I'm not running wifi-password
as root, it puts sudo on.
Removing the sudo
:
m ~ % nmcli -s -g 802-11-wireless-security.psk connection show $SSID | grep -q . && echo 'Password found'
Password found
One thing though, is that nmcli
has this functionality:
m ~ % nmcli device wifi show-password
SSID: [CLIPPED]
Security: WPA
Password: [CLIPPED FOR GITHUB]
█████████████████████████████████████
██ ▄▄▄▄▄ █▄▀ ▀ ▄▀▄ ██▄▀▀▄ ▄█ ▄▄▄▄▄ ██
██ █ █ █ █▀ █▄ ▀▀▄▄█ ███ █ █ ██
[TRUNCATED FOR GITHUB ...]
██▄▄▄▄▄▄▄█▄▄▄▄█▄███▄███▄█▄█████▄▄████
████████████████████████████████████
m ~ % printf '%s\n\n' "$(wifi-password --version)" "$(NetworkManager --version)" "$(nmcli --version)" "$(cat /etc/os-release | head -4)"
1.1.1
1.32.12-1
nmcli tool, version 1.32.12-1
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
Hey @mattalexx,
This seems strange. I can't quite remember why I am running that nmcli
command with sudo
because I just ran:
nmcli -s -g 802-11-wireless-security.psk connection show MY_SSID
and it gave me the password. Unlike on your system, the above command returns the password even when using sudo
on my system (Arch Linux with NetworkManager version 1.32.12-1).
I'm starting to think that sudo
might not be needed at all, but I'll have to take a further look as to why I initially included sudo
in that command when I wrote that function.
I do find it odd that running that command with sudo
does not work for you. Maybe it has something to do with permissions? Does running the command with sudo
output anything at all such as errors?