Solved Easy way to connect to wifi router

Hi

Is there an easier way to connect to a wifi router?

My current way looks like the following and I even don't know if it might to be like that, because it looks 'broken':
  1. Look for the SSID with: sudo ifconfig wlan0 scan
  2. Put the ssid and password in /etc/wpa_supplicant.conf
  3. Connect with the given SSID with: sudo ifconfig wlan0 ssid "the searched ssid name"
  4. Restart netif service otherwise internet will not work: sudo service netif restart
It would be very nice if there is a 'better' way, because I am travelling a lot and it just gets complicated.
 
Ok, networkmgr doesn't work well if it's about adding new ssids. There are several problems with doas, even if I used a doas.conf, which should fit with it. I tried vermadens script then and it has issues with doas too, even if he is providing a doas.conf. So I think I stick with wifimgr, even if the software doesn't show with which router I am connected :/
 
I use net-mgmt/networkmgr and it is good stuff.
Perhaps you have a typo or spacing error? The package message shows only this is needed:
/usr/local/etc/doas.conf
Code:
permit nopass keepenv root
permit :wheel
permit nopass keepenv :wheel cmd netcardmgr
permit nopass keepenv :wheel cmd ifconfig
permit nopass keepenv :wheel cmd service

but you still have to edit wpa_supplicant.conf by hand.
I think it is a good idea to clear out wpa_supplicant.conf and let networkmgr handle the entries.
 
I've changed the doas.conf and cleared the context of wpa_supplicant.conf. But it still don't work. Here is the output of networkmgr:

Code:
doas: Operation not permitted
/bin/sh: Syntax error: Unterminated quoted string
doas: Operation not permitted
Traceback (most recent call last):
  File "/usr/local/share/networkmgr/authentication.py", line 28, in add_to_wpa_supplicant
    Lock_Wpa_Supplicant(self.ssid, self.bssid, pwd, self.wificard)
  File "/usr/local/share/networkmgr/authentication.py", line 114, in __init__
    wsf = open(wpa_supplican, 'a')
PermissionError: [Errno 13] Permission denied: '/etc/wpa_supplicant.conf'

I did chmod 644 /etc/wpa_supplicant.conf. Does it need more rights?
 
Code:
wsf = open(wpa_supplican, 'a')
This calls open() with the "a" option (append text to file).
I guess it throws an exception if you make the file read-only.
 
I installed networkmgr, tried both ways via git and pkg install but it's not showing up on the menu bar. Any ideas?

Using FreeBSD 12.0-RELEASE-p10.

Cheers.
 
I've changed the doas.conf and cleared the context of wpa_supplicant.conf. But it still don't work. Here is the output of networkmgr:

Code:
doas: Operation not permitted
/bin/sh: Syntax error: Unterminated quoted string
doas: Operation not permitted
Traceback (most recent call last):
  File "/usr/local/share/networkmgr/authentication.py", line 28, in add_to_wpa_supplicant
    Lock_Wpa_Supplicant(self.ssid, self.bssid, pwd, self.wificard)
  File "/usr/local/share/networkmgr/authentication.py", line 114, in __init__
    wsf = open(wpa_supplican, 'a')
PermissionError: [Errno 13] Permission denied: '/etc/wpa_supplicant.conf'

I did chmod 644 /etc/wpa_supplicant.conf. Does it need more rights?
Is your user a member of wheel?
 
Is your user a member of wheel?

Correct I'm member of wheel on /etc/group and also I implemented all configs on doas. I followed the github instructions. In addition I installed GhostBSD and copied the configuration that was not on github. The basic difference now is that GhostBSD runs Mate (Gnome2) and FreeBSD Gnome is v3. I checked in my extensions but this top menu is not an extension.
 
Correct I'm member of wheel on /etc/group and also I implemented all configs on doas. I followed the github instructions. In addition I installed GhostBSD and copied the configuration that was not on github. The basic difference now is that GhostBSD runs Mate (Gnome2) and FreeBSD Gnome is v3. I checked in my extensions but this top menu is not an extension.
My GhostBSD is running XFCE;
 
Back
Top