[SOLVED-ISH] keyfile generator default conf location

Questions about WIFI networks and devices
Forum rules
Before you post please read how to get help
Post Reply
esar
Level 1
Level 1
Posts: 2
Joined: Thu Oct 15, 2020 9:17 pm

[SOLVED-ISH] keyfile generator default conf location

Post by esar »

Is there a way to set the default of autoconnect in the keyfile generation plugin of NetworkManager, such that new wifi connection files in /etc/NetworkManager/system-connections do not by default have autoconnect=true set?

I am aware that one can individually (after it is written) modify each connection file, such that autoconnect=false, but I am trying to modify the default setting that establishes this as true at time of generation, eg I don't want *new* connections to have autoconnect automatically/by-default set.

I've tried "autoconnect=false" in various sections of NetworkManager.conf, but that is having no effect.

Many thanks for any help/pointer. Using Cinnamon 20.
Last edited by esar on Sun Oct 18, 2020 7:40 pm, edited 1 time in total.
esar
Level 1
Level 1
Posts: 2
Joined: Thu Oct 15, 2020 9:17 pm

Re: keyfile generator default conf location

Post by esar »

no answers so i'll post the kludge solution i came up with: bash script in /etc/init.d to change the values before connecting

# script to change NM connection file default autoconnect from On to Off
# runs at boot

sudo cat > /etc/init.d/disable_autoconnect <<EOL
#! /bin/bash
### BEGIN INIT INFO
# Provides: disable_autoconnect
# Required-Start: $all
# Required-Stop: $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: sets autoconnect=no in all connection keyfiles
# Description: sets autoconnect=no in all connection keyfiles via nmcli
### END INIT INFO

SC="$(ls /etc/NetworkManager/system-connections/)"; IFS=.; VER=(${SC}); for I in "$VER"; do nmcli connection modify "$I" autoconnect no; done

nmcli con reload

exit 0
EOL

# make executable
sudo chmmod 755 /etc/init.d/disable_autoconnect

# update system
sudo update-rc.d disable_autoconnect defaults

# to remove
sudo rm /etc/init.d/disable_autoconnect
sudo update-rc.d disable_autoconnect remove
Post Reply

Return to “Wireless”