23

How do I set a system wide wireless WPA password that starts at boot time, allowing me to SSH in to the machine from outside, for example?

I'm running mythbuntu. Until I log in, WiFi doesn't connect, so I can't use SSH to log in from another computer, for example. When I have auto-login enabled, it asks me to enter my password to unlock my keyring before connecting. I've tried editing the connection and clicking "Available to all users", but then it just doesn't connect at all.

How do I go about debugging this problem, or how can I configure it totally manually?

rjmunro
  • 493

7 Answers7

15

When you are logged in and connected to the network, right-click the Network Manager icon. (It should be in the upper right of the screen.)

Click "Edit Connections..."

Find the connection you want to make available without login. Click it and click the "Edit" button.

Make sure the "Connect automatically" and "Available to all users" boxes are checked.

Now the connection will start up before anyone logs in and will be available to everyone on the system.

fader
  • 5,701
8

An easier solution: add the following lines to /etc/network/interfaces

auto wlp1s0
iface wlp1s0 inet dhcp
  wpa-essid wifiName
  wpa-psk Password

I have tested it on 16.04 LTS. May work on other versions.

Source: https://ubuntuforums.org/showthread.php?t=1963404

yozi
  • 81
6

for "regardless of being logged in," you'll need to edit your /etc/network/interfaces file...

http://ubuntuforums.org/showthread.php?t=263136

That link describes the process pretty well...

iface wlan0 inet static
  address 192.168.1.15
  netmask 255.255.255.0
  wireless-essid my_essid
  gateway 192.168.1.1
  pre-up wpa_supplicant -Bw -Dwext -i$IFACE -c/etc/wpa_supplicant.conf
  post-down killall -q wpa_supplicant
cjac
  • 171
2

For the sake of completeness, I'll also mention wicd, an alternative to Network Manager. I believe that if you configure wicd to connect automatically to a wireless network, it will happily do so at boot time.

1

Use wpa_ supplicant and dhclient

You will have to create a script that starts up at boot-time have a look here.

Have it run the following 3 commands (possibly from a script og sorts)

wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
sleep 10
dhclient wlan0

The contents of the wpa_supplicant.conf file should look something like this (using standard wpa-psk):

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
network={
    ssid="network-essid"
    scan_ssid=1
    key_mgmt=WPA-PSK
    psk="very secret passphrase"
}

look at the man page for wpa_supplicant.conf for more encryption options.

You might need to tweak the sleep command depending on how fast your router/netcard is at negotiating the connection. 10 seconds should be enough, but 5 or even 2 may be enough.

0

I have tried using the /interfaces or /interfaces.d/ to get to wireless with dhcp with wpa_supplicant but these did not work. But the only option that worked for me was, Adding the lines physically in /etc/rc.local

#!/bin/bash
sudo wpa_supplicant -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf &
sleep 10
sudo dhclient -v
exit 0
~   
Solo Man
  • 101
0

The main point is GDM and SDDM

for Gnome/Ubuntu the default is GDM you just need to share the wifi for all user and connect autometically from the wifi settings. wifi will connect on boot without login(user)

for KDE SDDM it does not work out of the box.

Sarkar
  • 13