Hi to all.
I want to add a new network(wifi network by its configurations, connection name, ssid, passwd etc.) by using shell script to my Porteus, I am using Porteus in usb stick therefore I do not want to enter all configurations all time by hand again and again. Is is possible to add a new network by using shell scripting? What I achieve is that, I wrote all config in a file and shell script read all those and add new wifi network connection to Porteus and I can only click "connect" and connect to my wireless connection.
I can handle coding part, I only want to know and guide about :
1. is is possible and,
2. where do I have to look for (i.e. man page of which commands ? what is the shell command behind network clients? etc.
Thanks.
[edited my question and add more info about what I want to achieve.]
[SOLVED] How to connect to a wifi network by shell script?
[SOLVED] How to connect to a wifi network by shell script?
Last edited by hope on 11 Jun 2023, 13:07, edited 1 time in total.
Newbie to Linux-Unix systems, try to read,learn, apply, modify and create.
How to connect to a network by shell script?
I think I found all commands I need in
https://developer-old.gnome.org/Network ... nmcli.html.
example :
given in the page will solve my problem.
https://developer-old.gnome.org/Network ... nmcli.html.
example :
Code: Select all
nmcli dev wifi con "Cafe Hotspot 1" password caffeine name "My cafe"
Newbie to Linux-Unix systems, try to read,learn, apply, modify and create.
- Ed_P
- Contributor
- Posts: 8374
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
[SOLVED] How to connect to a wifi network by shell script?
A very impressive find hope. Hopefully you will post a copy of your script when you're done. (obviously with tweaked passwords)
Ed
[SOLVED] How to connect to a wifi network by shell script?
Thanks Ed_P, actually at first, my script contained only one command line like :
Code: Select all
#!/bin/sh
nmcli dev wifi connect "ssid-of-wifi" password 123 name wifi1 hidden yes
Code: Select all
#!/bin/sh
nmcli c add type wifi con-name wifi1 ifname wlan0 ssid "ssid-of-wifi"
nmcli con modify wifi1 wifi-sec.key-mgmt wpa-psk
nmcli con modify wifi1 wifi-sec.psk 123
nmcli con up wifi1
Newbie to Linux-Unix systems, try to read,learn, apply, modify and create.