How to connect to a WPA2 enterprise with nmcli in a non interactive mode?
Kind of a late response, but maybe someone stumbles upon this same problem and may be looking for a solution.
Proper Solution
EDIT: Looks like I was wrong with both solutions, since I happened to get exact same error. However I found a solution to this - simply set all 802-1x
settings in one line, e.g.:
nmcli c modify <connection_name> 802-1x.eap <eap_mode> 802-1x.identity <username> 802-1x.phase2-auth <auth_type>
For what I've tested, these 3 settings are a minimum to setting 802-1x
property. I will leave the previous answer, for I believe these still might be applicable as part of the solution.
Previous Solution (for reference)
This looks like you are trying to set wifi-sec.key-mgmt
connection property before setting 802.1x
values. To put it simplier, you must put your edits in specified order, with 802.1x
settings first, and wifi-sec
keys later.
However, if that is not the case - do you have your connection already added? You can add an empty template using following command:
nmcli con add type wifi [ifname <interface_name>] [con-name <connection_name_shown>] [ssid <ssid_of_wifi_connection>]
All parts (not sure about con-name
) in []
can be skipped, but you would need to add them through modify
command later on for the network to run, unless you only have 1 WLAN interface.
Related videos on Youtube
user123456
Updated on September 18, 2022Comments
-
user123456 over 1 year
I am able to connect with
nmcli
to a WPA enterprise network only in an interactive mode launched bynmcli con edit id MYNAME
nmcli
refuses to change 802-1x values while not in edit mode:nmcli c modify MYNAME wifi-sec.key-mgmt wpa-eap Error: Failed to modify connection 'MYNAME': 802-1x: 'wpa-eap' security requires '802-1x' setting presence
How would you suggest to connect without "setting presence" which I don't want since I want to automatize the connection setting process.
-
Fabby over 7 yearsYou've just restored my faith in humanity! A first post that is of excellent quality! ;-) +1
-
Asunez over 7 years@Fabby I've been struggling with similiar issue, and came upon this question somehow, thought I could share with community ;)