Saving network signons

Technical issues/questions of an intermediate or advanced nature.
User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Saving network signons

Post#1 by Ed_P » 14 May 2022, 18:00

With Porteus 4.0 I could save my network signon when signing on with the changes= option by making a module of these files.

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/
I could then boot without the changes= option and with the module and be automatically connected to my network. :) A module with these files does not work with Porteus 5.0rc. When I boot without the changes= option and with the module I have to signon to my network. :(

I've booted Porteus 5.0rc in AF mode, signed on to my network and run the changes script to see what's been changed and created new modules with these files.

Code: Select all

#                  -- Network files --
# touch             /var/lib/dhcpcd/dhcpd.leases
cp -a --parents    /etc/NetworkManager/system-connections/*       /tmp/mod/
cp -a --parents    /etc/resolv.conf                               /tmp/mod/
cp -a --parents    /var/run/NetworkManager/*                      /tmp/mod/
cp -a --parents    /var/run/syslogd.cache                         /tmp/mod/
cp -a --parents    /var/lib/NetworkManager/*                      /tmp/mod/
cp -a --parents    /var/lib/xkb                                   /tmp/mod/
#                  Porteus 4.0
#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/

But every time I boot without the changes= and with the module of the changes shown above I have to signon to my network. :wall:

What am I missing???
Ed

User avatar
babam
Warlord
Warlord
Posts: 526
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 5.0rc3 Xfce K6.1.1
Location: Rainy city

Saving network signons

Post#2 by babam » 17 May 2022, 20:38

You just need /etc/NetworkManager/system-connections/*.nmconnection
Sorry, my English is bad.

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

Saving network signons

Post#3 by Ed_P » 17 May 2022, 22:56

Thanks babam. :)
babam wrote:
17 May 2022, 20:38
You just need /etc/NetworkManager/system-connections/*.nmconnection
Doesn't this add it to my module??
Ed_P wrote:
14 May 2022, 18:00

Code: Select all

cp -a --parents    /etc/NetworkManager/system-connections/*       /tmp/mod/
:%)
Ed

User avatar
babam
Warlord
Warlord
Posts: 526
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 5.0rc3 Xfce K6.1.1
Location: Rainy city

Saving network signons

Post#4 by babam » 18 May 2022, 00:09

Right-click nm-applet icon --> Edit Connections --> Wireless tab --> YourSSID --> Edit --> General tab:
Check --> "Automatically connect to this network when it is available"
Check --> "All users may connect to this network"
Save
Sorry, my English is bad.

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

Saving network signons

Post#5 by Ed_P » 18 May 2022, 06:17

babam wrote:
18 May 2022, 00:09
Check --> "Automatically connect to this network when it is available"
Check --> "All users may connect to this network"
Both connections are configured that way.

Code: Select all

guest@porteus:~$ ls /etc/NetworkManager/system-connections/*.nmconnection
Auto\ Linksys09841-5GHz.nmconnection
Auto\ QuickGoose-pro.nmconnection
guest@porteus:~$ ls /tmp/mod/etc/NetworkManager/system-connections/*.nmconnection
Auto\ Linksys09841-5GHz.nmconnection
Auto\ QuickGoose-pro.nmconnection
The network files are being copied to the module's folder.

Another odd part of this scenario, when I signon to the wifi with the system using the module and not the save.dat file and remake the module, the wifi signons are automatic on future boots with the module. :crazy: :%) .
Ed

User avatar
babam
Warlord
Warlord
Posts: 526
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 5.0rc3 Xfce K6.1.1
Location: Rainy city

Saving network signons

Post#6 by babam » 18 May 2022, 10:29

Do it as root when copying *.nmconnection and creating a module
Sorry, my English is bad.

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

Saving network signons

Post#7 by Ed_P » 18 May 2022, 16:09

babam wrote:
18 May 2022, 10:29
Do it as root
Yup. Always.

Code: Select all

if [ `whoami` != "root" ]; then
#   echo -e "Enter root's password"
#   cyan "Enter root's password"
#   su -c "sh $0 $1 $2"
   echo toor | sudo -S  echo "******"
   sudo sh $0 $1 $2
   exit
fi
Added in 10 hours 54 minutes 6 seconds:

:%) How is it that the Nemo view of my *.nmconnections on my changes= system show a date of Fri 18 Mar 2022? Shouldn't the dates be Wed 18 May 2022?
Image

Actually all the entries in /etc/NetworkManager/system-connections/ folder show the Mar date.

On the system without the changes= option and with the module the /etc/NetworkManager/system-connections/ folder shows all the same entries with the Mar date but also an .nmconnection entry with the current date.

Code: Select all

ls -lght /etc/NetworkManager/system-connections/*.nmconnection 
-rw------- 1 root 358 May 18 15:57 /etc/NetworkManager/system-connections/Auto\ QuickGoose-pro-94ef9d48-5ada-4280-806f-544e8755624b.nmconnection
-rw------- 1 root 364 Mar 18 01:36 /etc/NetworkManager/system-connections/Auto\ Linksys08941-5GHz.nmconnection
-rw------- 1 root 358 Mar 18 01:36 /etc/NetworkManager/system-connections/Auto\ QuickGoose-pro.nmconnection
Ed

User avatar
babam
Warlord
Warlord
Posts: 526
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 5.0rc3 Xfce K6.1.1
Location: Rainy city

Saving network signons

Post#8 by babam » 19 May 2022, 08:27

How about md5sum or compare with diff?
Sorry, my English is bad.

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

Saving network signons

Post#9 by Ed_P » 19 May 2022, 14:54

babam wrote:
19 May 2022, 08:27
How about md5sum or compare with diff?
:%)

Added in 21 minutes 28 seconds:

Code: Select all

guest@porteus:/etc/NetworkManager/system-connections$ su
Password: 
root@porteus:/etc/NetworkManager/system-connections# diff *-pro.nm* *-pro-94*
3c3
< uuid=42cb3a60-f81b-489a-854f-244087b884dc
---
> uuid=94ef9d48-5ada-4280-806f-544e8755624b
5c5
< interface-name=wlan1
---
> interface-name=wlan0
The main question is; why? Same notebook, same OS, same modules, same network, same router. Something is in my save.dat file that isn't in my module.

Added in 1 day 11 hours 51 minutes 6 seconds:
So, for the changes= system I was able to pull up root's terminal history which shows a fair amount to network activity.

Code: Select all

cd /etc/rc.d
./rc.local_shutdown
./rc.local_shutdown
cd /etc/rc.d
./rc.local_shutdown
chmod +x *.sh
startx
boot
exut
reboot
xpsinfo
exit
parted 50rc3save.dat p
parted 50rc3save.dat p
ls -l 50rc3*
ls -lh 50rc3*
whereis pysol.*
rm /mnt/live/memory/images/changes/root/.local/share/gvfs-metadata/.wh.root-*.log
DBus
service
keycode
showkey d
showkey -a d
showkey -a 
./live-usb
iwlist scan
e4defrag
e2fsprogs
xpsinfo
fsck.ext2 -v
fsck.ext2 -V
ls -o /usr/sbin/NetworkManager
list disk
rm -rf /mnt/live/memory/images/changes/home/guest/.cache/mozilla/firefox/dxsqumip.default
modinfo -F firmware
/usr/lib/modules/5.15.1-rc7-porteus/kernel/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko
/usr/lib/modules/5.15.1*
modinfo -F firmware /usr/lib/modules/5.15.1-rc7-porteus/kernel/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko
modinfo -F firmware /usr/lib/modules/5.15.1*
cd /etc/
find . -maxdepth 3 -type f -exec grep -n "BOOTDEV" "{}" \;
find . -maxdepth 3 -type f -exec grep -l "BOOTDEV" "{}" \;
find . -maxdepth 3 -type f -exec grep -ln "BOOTDEV" "{}" \;
find . -maxdepth 3 -type f -exec grep -l -n "BOOTDEV" "{}" \;
find . -maxdepth 3 -type f -exec grep -nr  "BOOTDEV" "{}" \;
find . -maxdepth 3 -type f -exec grep -lnr  "BOOTDEV" "{}" \;
rm /mnt/live/memory/images/changes/etc/NetworkManager/system-connections/.wh.*
rm /mnt/live/memory/images/changes/root/.local/share/gvfs-metadata/.wh.root-*.log
touch /var/lib/dhcpcd/dhcpd.leases
touch /var/lib/dhcpcd/dhcpd.leases
 touch /var/lib/dhcpcd/dhcpd.leases
touch /var/lib/dhcpcd/dhcpd.leases
touch /var/run/NetworkManager/*
touch /var/lib/NetworkManager/*
touch /var/lib/dhcpcd/*
touch /etc/resolv.conf 
touch /etc/hosts
touch /etc/NetworkManager/system-connections/*
gconf-editor
gnome_settings_daemon
gsettings
gsettings get org.gnome.settings-daemon.plugins.housekeeping free-size-gb-no-notify
dconf-editor
gsettings get org.cinnamon.settings-daemon.plugins.housekeeping free-size-gb-no-notify
dconf-editor
But unfortunately I don't remember what I did to pull it so I can't do it for the modules system. :wall: I can pull up the .bash_history for guest but not for root. And guest's history is hugh, for a freshly booted system, is there a command to delete old history?
Ed

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3924
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

Saving network signons

Post#10 by ncmprhnsbl » 21 May 2022, 03:52

Ed_P wrote:
21 May 2022, 03:06
And guest's history is hugh, for a freshly booted system, is there a command to delete old history?

Code: Select all

history -c && history -w
should clear it.. EDIT: history -c clears the present shell history buffer and history -w writes that 'cleared' history to the .bash_history file...
or maybe just

Code: Select all

cat /dev/null > ~/.bash_history
i imagine just deleting ~/.bash_history would do it too.. (it should be automatically remade on next bash login)
Last edited by ncmprhnsbl on 21 May 2022, 07:43, edited 1 time in total.

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

Saving network signons

Post#11 by Ed_P » 21 May 2022, 05:01

Thanks ncmp. Some problems using history.

Code: Select all

guest@porteus:~$ history
    1  .bash_history
    2  find .bash_history
    3  cat .bash_history
    4  su
    5  history
guest@porteus:~$ su
Password: 
root@porteus:/home/guest# history .bash_history
bash: history: .bash_history: numeric argument required
root@porteus:/home/guest# find .bash_history
.bash_history
root@porteus:/home/guest# cat .bash_history
.bash_history
find .bash_history
cat .bash_history
su
root@porteus:/home/guest# history cat .bash_history
bash: history: cat: numeric argument required
root@porteus:/home/guest#
root@porteus:/home/guest# cd ..
root@porteus:/home# cd ..
root@porteus:/# cat .bash_history
cat: .bash_history: No such file or directory
root@porteus:/#  
Ed

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3924
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

Saving network signons

Post#12 by ncmprhnsbl » 21 May 2022, 07:52

Ed_P wrote:
21 May 2022, 05:01
Some problems using history.
not sure what you're trying to do .... note if you're after root's bash history, it's /root/.bash_history (or simply "history" as root)
since history is a bash 'builtin'

Code: Select all

help history
gives some usage info..
i edited the previous post with some corrected commands for clearing the .bash_history file..
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

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

Saving network signons

Post#13 by Ed_P » 21 May 2022, 15:01

I've figured out where the .bash_history files are located.

Code: Select all

guest@porteus:~$ echo $HISTFILE
/home/guest/.bash_history
guest@porteus:~$ su
Password: 
root@porteus:/home/guest# echo $HISTFILE
/root/.bash_history
root@porteus:/home/guest#
:)
And "history" without arguments displays the current window's session history with sequence numbers in front of it!
Ed

donald
Full of knowledge
Full of knowledge
Posts: 2063
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

Saving network signons

Post#14 by donald » 22 May 2022, 06:26

I made an entry in my .bash_history file to clear it from time to time.
> ~/.bash_history

Code: Select all

guest@porteus:~$ > ~/.bash_history

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

Saving network signons

Post#15 by Ed_P » 23 May 2022, 06:09

Ok, thank you guys, both .bash_history files have been cleaned out. And we are back to the topic of this thread, what files do I have to save to my module to have the wifi connections connect?

Interesting to note that the wifi connection with the long name has a different name today than the one posted previously.

Code: Select all

guest@porteus:~$ ls -lght /etc/NetworkManager/system-connections/*.nmconnection
-rw------- 1 root 358 May 23 02:05 /etc/NetworkManager/system-connections/Auto\ QuickGoose-pro-f60c26a2-ce15-4d78-93f3-3fdb0d2db3d4.nmconnection
-rw------- 1 root 364 Mar 18 01:36 /etc/NetworkManager/system-connections/Auto\ Linksys08941-5GHz.nmconnection
-rw------- 1 root 358 Mar 18 01:36 /etc/NetworkManager/system-connections/Auto\ QuickGoose-pro.nmconnection
guest@porteus:~$
Added in 6 minutes 41 seconds:
Ed_P wrote:
19 May 2022, 03:03

Code: Select all

ls -lght /etc/NetworkManager/system-connections/*.nmconnection 
-rw------- 1 root 358 May 18 15:57 /etc/NetworkManager/system-connections/Auto\ QuickGoose-pro-94ef9d48-5ada-4280-806f-544e8755624b.nmconnection
-rw------- 1 root 364 Mar 18 01:36 /etc/NetworkManager/system-connections/Auto\ Linksys08941-5GHz.nmconnection
-rw------- 1 root 358 Mar 18 01:36 /etc/NetworkManager/system-connections/Auto\ QuickGoose-pro.nmconnection
Ed

Post Reply