2

I want to connect to a free open wifi, like Starbucks, but I don't want a full-fledged desktop gui like Unity or GNOME. How can I do this via command-line (pretending my install base is Ubuntu Server + drivers for my wifi card)?

djeikyb
  • 30,245

3 Answers3

1

First, run ifconfig wlan0 up. This will enable wireless. You won't get any feedback unless there's a problem. Next, run iwlist wlan0 scan to scan for nearby wireless networks. Once you have looked at the output and know which wireless network you want to connect to, run iwconfig wlan0 essid NETWORK_ID key s:WIRELESS_KEY, replacing NETWORK_ID with the name (essid) of the nework and WIRELESS_KEY with the network passcode. Hope that helps!

William
  • 7,668
1

you can use iwconfig. I have done it with wep. normally this is enough

iwconfig ethX essid ESSID key open XXXXXXXXXX

and then call the dhcp client with dhclient3 ethx

I'm doing this from memory. But check the manual of iwconfig for more info

man iwconfig

1

Using RHEL 7.0/CentOS make a file called ifcfg-starbucks, fill it with the following information:

ESSID="Google Starbucks"
MODE=Managed
TYPE=Wireless
BOOTPROTO=dhcp
DEFROUTE=no
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=Google Starbucks
ONBOOT=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTE=yes
DEVICE=wlp6s0
KEY_MGMT=WPA-PSK
WPA_ALLOW_WPA=yes
WPA_ALLOW_WPA2=yes
MAC_ADDRESS_RANDOMIZATION=default
PEERDNS=yes
PEERROUTE=yes

then create a file called /etc/wpa_supplicant/wpa_supplicant_starbucks.conf

fill it with this information:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
update_config=1

network={
    ssid="Google Starbucks"
    key_mgmt=NONE
    priority=100
    scan_ssid=1
}

then initiate the wpa_supplicant:

wpa_supplicant -i wlp6s0 -c /etc/wpa_supplicant/wpa_supplicant_starbucks.conf -B

then turn on your dhclient:

dhclient wlp6s0

Cheers ;-)

muru
  • 197,895
  • 55
  • 485
  • 740