我已通过以太网连接到互联网,但已保存 wifi 密码。
该文件夹/etc/NetworkManager/system-connections
是空的。
此命令不显示任何内容(将变量替换为所需的 uuid):
# nmcli -s -g 802-11-wireless-security.psk connection show $UUID
这也没有帮助:
# for uuid in $(nmcli -g UUID connection show); do
nmcli -g 802-11-wireless.ssid,802-11-wireless-security.psk connection show $uuid | awk -F: '{
if (NR == 1) printf "SSID: %s\n", $0;
if (NR == 2) printf "Password: %s\n\n", $0;
}'
done
该代码的输出:
SSID: Home_WiFi
Password: <hidden>
SSID: Starbucks_clients
Password: <hidden>
SSID: Sony_phone_hotspot
Password: <hidden>
有什么帮助以纯文本形式获取密码吗?它们被存储在某个地方,因为 wifi 会自动重新连接和验证,无需重新输入密码。
这些是 @Raffa 建议的命令,经过一些小修改:
# nmcli dev wifi show-password
Error: No Wi-Fi device found.
# for conn in $(nmcli -t -f NAME con show); do
echo "Details for $conn:"
nmcli connection show "$conn" --show-secrets | grep 802-11-wireless-security.psk
done
Details for Wired:
Error: Wired - no such connection profile.
Details for connection:
Error: connection - no such connection profile.
Details for 1:
Error: 1 - no such connection profile.
Details for lo:
Details for virbr0:
Details for Home_WiFi:
802-11-wireless-security.psk: --
802-11-wireless-security.psk-flags: 1 (agent-owned)
Details for Starbucks_clients:
802-11-wireless-security.psk: --
802-11-wireless-security.psk-flags: 1 (agent-owned)
Details for Sony_phone_hotspot:
802-11-wireless-security.psk: password1
802-11-wireless-security.psk-flags: 0 (none)
现在,有些网络显示密码,而另一些则不显示。
- 更新 -
密码由 存储/usr/bin/kwalletmanager5
。知道如何从命令行提取它们吗?