After changing the Wifi Network password in the Router, My Arch Linux test machine lost the Internet connection. So I wanted to update the new password from Terminal because my Arch Linux test box doesn't have graphical desktop environment yet. Changing old wifi password to new password is pretty easy in GUI mode. I will simply open the network manager and update the new password to the wifi in few seconds. However, I am not aware of updating the wifi network password from command line in Arch Linux. So, I started to dig into Google and find a working solution from the Arch Linux forum. In case you ever been in the same situation, read on. It's not that difficult.
Update Wifi Network Password From Terminal
After changing the password in Router, I ran wifi-menu command to update the new password. But It kept throwing the following error.
$ sudo wifi-menu
It displayed the list of available wifi networks.
My wifi network name is Murugs9376. Then, I selected my network and hit OK button. Instead of asking the new password (I thought it was going to ask me if the password has been changed.), It showed the following error.
Interface 'wlp9s0' is controlled by netctl-auto WPA association/authentication failed for interface 'wlp9s0'
At the time of this error happened, I didn't have much experience with Arch based distributions. So I went thorough the Arch linux forum hoping for the solution. Thankfully, someone has posted the same problem and got the workaround from one of the fellow Arch user. Following is the solution to update the wifi network password from Terminal in Arch based distributions.
The network profiles is stored in the /etc/netctl/ folder. For example, here is my Arch Linux test box wifi network profile details.
$ ls /etc/netctl/ Sample Output: examples ostechnix 'wlp9s0-Chendhan Cell Service' wlp9s0-Pratheesh hooks wlp9s0 wlp9s0-Murugu9376 interfaces wlp9s0-AndroidAP wlp9s0-none
All I need to update the new password is to delete the my wifi network profile (Ex. wlp9s0-Murugs9376) and re-run the wifi-menu command to new password.
So, first let us delete the wifi profile using command:
$ sudo rm /etc/netctl/wlp9s0-Murugu9376
After deleting the profile, run wifi-menu command to update the new password.
$ sudo wifi-menu
Select the wifi-network and press ENTER.
Enter a name for the profile.
Finally, Enter the security key to the network profile and hit ENTER key.
That's it. Now, we have updated the password of the wifi network. As you can see, updating password from Terminal in Arch Linux is no big deal. Anyone could do it in a matter of seconds.