Wi-fi : save settings and passwords

Post tutorials, HOWTO's and other useful resources here.
Rapha_
Shogun
Shogun
Posts: 238
Joined: 12 Jun 2021, 21:59
Distribution: Xfce 4.12 - 5.rc3 - x86_64
Location: France

Wi-fi : save settings and passwords

Post#1 by Rapha_ » 27 Oct 2021, 00:06

.

When you enter your password for a Wi-fi connection, it is stored in a file but is not kept if you do not use the "save changes" mode.

There is a way to keep this file for a next connection, by copying it after creating its mirror folder in the rootcopy one


Attention, this method works only for those who use a Linux partition (ext2/ext3/ext4) : because this file uses the necessary permissions to work (only the root user can
see its content), but these permissions are not kept on ntfs or fat32 partitions (I explain below how to solve this problem by using a module


So for those who use a linux partition (but also for those who have an ntfs or fat32 partition), build the location of this file by creating the folders tree

First, if you have started Porteus as guest, connect to your Wi-fi Network with the appropriate password...the connections settings file will be then automatically created


Open the file manager (as root)
Go to the root/Desktop/ and open terminal here (root)


Run this command as root on desktop (With no / before etc/ it is important) :

Code: Select all

root@porteus:~/Desktop# mkdir -p etc/NetworkManager/system-connections/

Go to the directory (File Sytem) /etc/NetworkManager/system-connections/ with the file manager (root)
Copy the file like "Mybox-10a8e.nmconnection" where the password and others settings are saved (visible as root)
Paste it inside the directory "system-connections" you created on /root/Desktop

And then, copy the "etc" folder from /root/Desktop/ to your /porteus/rootcopy/


Reboot your computer, the connections settings must be saved...



if you use Porteus with a fat32 or ntfs filesystems, you need to create a module: it is the solution to preserve the permissions

Since the content of the "etc" folder is already created on the /root/Desktop/ (see the sequence of tasks above), you only have to create a "Wifi-connection" folder and copy the "etc" in it.
Then, always as "root" with the file manager, right click on the folder "Wifi-connection" and then "Create xzm module".
the job is done, you just have to copy the created module to the module folder (be careful, not in the "optional" folder otherwise it won't work ! Also no activation with this module once Porteus started...)


idem, restart your computer, the connection settings must be functional..

.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Wi-fi : save settings and passwords

Post#2 by Ed_P » 27 Oct 2021, 03:58

The script I use to save changes, as root, has these lines.

Code: Select all

#                  -- Network files --
#                  touch /var/lib/dhcpcd/dhcpd.leases
cp -a --parents    /etc/NetworkManager/system-connections/*       /tmp/mod/
cp -a --parents    /var/run/NetworkManager/*                      /tmp/mod/
cp -a --parents    /var/lib/dhcpcd/*                              /tmp/mod/
cp -a --parents    /etc/hosts                                     /tmp/mod/
The module is saved on a NTFS file system and loaded when I boot the Porteus ISO.
Ed

Kulle
Warlord
Warlord
Posts: 594
Joined: 28 Jan 2017, 10:39
Distribution: v4.0 64bit Xfce
Location: Berlin

Wi-fi : save settings and passwords

Post#3 by Kulle » 27 Oct 2021, 08:03

Hi,
I am using a little script, just a network manager command.

Code: Select all

#!/bin/bash
nmcli dev wifi connect xxxxxx password "yyyyyy"
exit 0
The execution of this script establishes the WIFI connection.
Where xxxxxx is the name (SSID) of the wireless network and yyyyyy the password.

Post Reply