Saturday, November 1, 2014

KDE network manager not remembering wpa password

I'm using Kxstudio on my desktop PC and it's great for my purposes, I highly recommend Kxstudio for home studio enthusiasts.
But there was a little problem that bugged me from the beginning, and that is that for some reason, the NetworkManager applet would not remember my wpa password.
Every time I turned on the PC I would have to enter the password manually, and that's a real pain with a 35 character password.
nmcli to the rescue!
Add the following line to a file called connectWifi.sh
#!/bin/bash

sudo nmcli dev wifi con "My essid" password my_long_passphrase name "My connection name"
Then make the file executable with the following command
$ chmod +x connectWifi.sh

Then  we add this command to the sudoers file so that we don't have to insert a password every time we use nmcli.
Open the sudoers file with the following command:
$ visudo
And then add at the end of the file the following line:
youruser ALL=(ALL:ALL) NOPASSWD: /usr/bin/nmcli
Replacing youruser with your linux user name.


Finally we add the script to the autostart window located at SystemSettings -> startup & shutdown -> autostart -> Add Script... and navigate to the script file.



And that's it!

No comments:

Post a Comment