0

I am running an Ubuntu 16.04 derived Linux on an embedded processor, Yocto build

Kernel appears to be 4.14.141

I am bringing up a WiFi Access point on the hardware programmatically from C by enabling the radio with a call to

system("nmcli r wifi on");

( This may be superfluous at the moment but bear with me.)

At which point I bring up an access point with

system( "nmcli dev wifi hotspot ifname wlan0 ssid \"test\" password \"test1234\" ")

So Now I have in /etc/NetworkManager/system-connections a file Hotspot.nmconnection with the correct details for this access point

[connection]
id=Hotspot-2
uuid=70c76bd2-0e13-492e-8a45-9094bc6e0773
type=wifi
autoconnect=false
permissions=

[wifi]
mac-address=00:04:F3:1B:BA:AE
mac-address-blacklist=
mode=ap
ssid=test

[wifi-security]
group=ccmp;
key-mgmt=wpa-psk
pairwise=ccmp;
proto=rsn;
psk=test1234

[ipv4]
dns-search=
method=shared

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

My problem is that each time I want to use this access point I want to bring it up with a different SSID and a different password. The Access point is tied to a users session so its life is limited to that session and a set of credentials ( not available except through a passed hardware token ) The Wifi AP starts up to match the presented token and is shut down and can be destroyed after the token is removed.

Attempting to modify this configuration file with nmcli

system ("nmcli con mod Hotspot ssid \"newTest\" password \"newpass\" ");

fails with

Error: invalid <setting>.<property> 'password'.

redefining the AP with the first command results in a successful new wifi AP being created but it gains a new configuration file with a number suffix based on the previous itterations Hotspot-2, Hotspot-n etc, wont be long until my flash overflows.

So how do I do this? Where and how do I define a password file which is what I gather I need or how do I change things to allow me to achieve my goal? I have a suspicion that I need to get polkit involved but that's a rabbit warren I have not been down yet.

1 Answer 1

0

You have a profile. See it with nmcli connection.

Above, you see that the name of the profile is Hotspot-2 (and UUID 70c76bd2-0e13-492e-8a45-9094bc6e0773).

Modify the profile, and depending on whether you know the UUID or the name, refer to it accordingly:

nmcli connection modify Hotspot-2 ...
nmcli connection modify 70c76bd2-0e13-492e-8a45-9094bc6e0773 ...
nmcli connection modify id Hotspot-2 ...
nmcli connection modify uuid 70c76bd2-0e13-492e-8a45-9094bc6e0773 ...

(I am just saying this, because you can refer to the profile in different ways).

Anyway. So modify it:

nmcli connection modify Hotspot-2 \
   wifi.ssid My-SSID \
   wifi-sec wifi-sec.psk new-passwd

The changes to the profile take effect immediately (to the profile), but they only become effective once you re-activate the profile the next time:

nmcli connection up Hotspot-2

You must log in to answer this question.

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