Slightly easier topic today 🙂
A while ago I had to set up an Ubuntu machine so that after a reboot it would automatically log in to Gnome and connect to WLAN with the correct wlan key. There’s propably many ways of doing this and it might be quite easy to do with GUI but here’s how to do it from the command line.
WLAN key configuration
For setting the wlan key we need to modify the Network Manager configuration.
The configuration files for all your known connections are here:
You need to add the key to the appropriate config. In my case it was Auto Wlan212. Sudo is needed for editing the file. There’s a lot of settings you can play with but the section for the wlan key is under
Before I modified anything these two lines were there already:
And then I just added the wlan key there like this:
psk=[your key here]
So here’s what the security part of the config looks like now:
[802-11-wireless-security] key-mgmt=wpa-psk psk-flags=1 psk=JGKFOC82JC7SK
Now you can check if it’s working by restarting the network-manager service:
sudo service network-manager restart
It should connect to the wireless without asking the wlan key.
You can add the keys for all your known wlan connections so you never have to type those again.
This is guide is only for Gnome.
The automatic login is handled by GDM(Gnome Display Manager). The configuration file is this one:
The settings are quite simple. This was the config in my case:
[daemon] AutomaticLoginEnable=false AutomaticLogin=simo TimedLoginEnable=false TimedLogin=simo TimedLoginDelay=10 DefaultSession=unity-2d
The most important lines are these two:
Just change the AutomaticLoginEnable to true:
And replace ‘simo’ with your username.
After you’ve edited the file, restart the gdm service:
The goal was to have automatic login and wireless internet connection without needing to type the wlan key after a reboot. Final test to see if that was accomplished:
sudo shutdown -r 0
Now after the reboot it should log in and connect to the wlan automatically. However you might be prompted for a keyring password. To get rid of this password prompt. Remove your login keyring:
If you have different or better approaches for this, feel free to share it by replying to this post. This is how I have done it but I’d like to hear other solutions.