Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Would like a script, when run, it should connect to a hidden wireless network with these details:

SSID is "Wireless" Network is not broadcasting its SSID above (is hidden) WPA2-PSK, AES, password is "password" Static IP: Def. gateway: DNS:

No idea how to do this. But I do know the wireless interface is called wlan0 and I'm on Ubuntu 10.10. I don't want to use the built in Network Manager as it never auto-connects on startup. WICD doesn't work either.

Any ideas most welcome.

share|improve this question
This question appears to be abandoned, if you are experiencing a similar issue please ask a new question with details pertaining to your problem. If you feel this question is not abandoned, please flag the question explaining that. :) – Seth Dec 29 '12 at 4:34

Check out this page on the Arch wiki about using WPA supplicant:

Once you've set the password in wpa_supplicant.conf, you should be able to connect using the 2 commands below. Just save those in a script. Other settings are saved.

ifconfig wlan0 up
iwconfig wlan0 essid <hiddenname>

Edit your IP address and gateway in /etc/network/interfaces

share|improve this answer

If network-manager and wicd fail, then it is possible that you have a somewhat broken driver like rt2860sta that refuses point blank to connect to hidden essid (but at least rt2800pci works for me in this case).

You can try to do it using /etc/network/interfaces and /etc/wpa_supplicant/wpa_supplicant.conf something like (modulo the broken driver, so it still won't work):


auto wlan0
iface wlan0 inet static
 wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf





and set the DNS in /etc/resolv.conf

man pages for interfaces, wpa_supplicant.conf and resolv.conf may help.

share|improve this answer

Have managed to fix my original problem of Network Manager not connecting so won't need the script now (but thanks to everyone for your help).

The problem was that in my wireless settings I had ticked the box to apply this wireless network to all users. That makes it require root access. When I turn on the laptop, it would not connect to the wireless network. It didn't even prompt for a password. All I've done is untick that box and apply this wireless network to each user manually. It now connects immediately upon startup.

share|improve this answer

Add the line wpa-scan_ssid 1 after iface wlan0 inet dhcp in the file /etc/network/interfaces.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.