0

I'm trying to use D-bus method AddAndActivate connection on interface org.freedesktop.NetworkManager to create a wifi connection. I definitely pass a PreSharedKey field with the password, but NetworkManager ignores this field, fails on connection activation and asks for a password when I try to use nmcli c up <Connection>.

Any ideas how to force it to save the password?

2 Answers 2

0

Have a look at the files in the /etc/NetworkManager/system-connections/ directory.

All WiFi connections are stored here. Try to append the password manually.

Here is an example of my config:

[connection]
id=<SSID>
uuid=<UUID>
type=wifi
interface-name=<INTERFACE>
permissions=

[wifi]
mac-address-blacklist=
mode=infrastructure
ssid=xxxxx

[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=XXXXXXX                       <- Enter password here

[ipv4]
dns-search=
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto

[proxy]
1
  • This would be a workaround...
    – Edward
    Commented May 17, 2020 at 9:27
0

Finally, I found a solution on how to create and activate connections programmatically and do not be asked for password on activation. Instead of org.freedesktop.NetworkManager.AddAndActivateConnection() you can use org.freedesktop.NetworkManager.Settings.AddConnection() and then just call org.freedesktop.NetworkManager.ActivateConnection(). You will not be asked for password

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .