Recently I started asking myself how I could get Ubuntu to forge its wireless connection (with WEP encryption) to my router without having to log-in through the GUI. I noticed that the default way of logging in through the GUI and then having a wireless connection available was limiting for two reasons: (1) If I wanted to be able to connect to my openSSH server then I needed to be logged in, and (2) If there was something wrong with the GUI and I had to log-in through the command line then I wouldn't have internet access.
So I started looking around on the net. Most pages that I found showed messageboard threads suggesting modifications to the /etc/network/interfaces file. This is the file that is supposed to tell your Linux system what to do with your network interfaces at boot-up. I tried to modify it so that my wireless card would start-up with a static IP at boot-up, but no matter how I changed this file, nothing worked.
Finally, I decided to ask a question on ubuntuforums. I found out that Gnome Network Manager, the program in Ubuntu which manages all your wired and wireless network connections, works terribly with the settings in the /etc/network/interfaces file. In other words, if you want Ubuntu to start your wireless connection at bootup instead of after login, you have to get rid of Gnome Network Manager!
So, on the advice of chili555 from ubuntuforums, I got rid of Gnome Network Manager by typing in sudo apt-get remove --purge network-manager and modified my /etc/network/interfaces file to look like the following (SSID and WEP key changed for privacy):
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet static
address 192.168.2.11
netmask 255.255.255.0
gateway 192.168.2.1
wireless-essid MYSSID
wireless-key 12345678912345678912345678
iface eth0 inet dhcp
Now, every time I start my computer, my wireless connection is available before login so that I can login to my openSSH server or go to the command-line without logging in to the GUI!
Tuesday, February 9, 2010
Subscribe to:
Post Comments (Atom)
Thank you I had been going crazy looking for a fix for the same issue. I even tried changing that interfaces file as well.
ReplyDeleteI don't know if this will be a problem, but I've read that UbuntuOne requires that Network Manager be running.
ReplyDeleteI had the same problem, but I don't think it's a bug.
ReplyDeleteFor me what worked was simply to edit my connection in the Network Manager and check the box "Available to all users" (I also have "Connect Automatically" checked).
Now it connects as soon as it boots up, before the first login.
I had tried to use the "Available to all users" checkbox, but every time I clicked on it my connection got messed up. That's why I went through the process I described in this post and installed WICD. They just work better :)
ReplyDeleteIt's a good solution, however it does have a minor security issue to consider. The challenge with the /etc/network/interfaces file is that your WEP key is stored plain text in that file. The gnome network manager stores the key in it's keychain, which makes the key a whole lot more secure...
ReplyDeleteJT
Hello, I do not agree with the previous commentator - not so simple
ReplyDeletemy wireless connection works most of the time but soon as i loose signal i just type in the code and it works again, maybe you need to change your box.
ReplyDeleteThen, how to detect SSID and auto connect to it, instead of hard code the SSID in the configuration?
ReplyDeletethanks men this is what i looking for
ReplyDeleteThis is exactly what I was looking for. Great job for posting this. Other Google searches had more complicated instructions, that did not really provide a good solution to this problem. Thanks a lot!!
DeleteDuring reboot/restart of your system, you can create a script (.sh shell script file) that is run during reboot, that will send an email and send a message to your cell phone.
DeleteCopy the script file to /etc/init.d/ to make it part of the boot-up sequence.
This is how you do this:
Reference- http://ubuntu.wordpress.com/2005/09/07/adding-a-startup-script-to-be-run-at-bootup/
So you have a script of your own that you want to run at bootup, each time you boot up. This will tell you how to do that.
Write a script. put it in the /etc/init.d/ directory > sudo cp reboot-send-email.sh /etc/init.d/
Lets say you called it reboot-send-email.sh. You then run
sudo update-rc.d reboot-send-email.sh defaults
You also have to make the file you created, reboot-send-email.sh, executable, using
sudo chmod +x /etc/init.d/reboot-send-email.sh
----------------------------------
#
## send to cell phone that system was rebooted
#
# sendEmail -f laptop_reboot`date +%Y%b%a%d_%H%M`@gmail.com -t @ -u " laptop Restart" -m " Started on > "`date +%Y%b%a%d_%H%M` -s smtpauth..net -xu -xp
#
## send email that system was rebooted
#
# sendEmail -f laptop_reboot`date +%Y%b%a%d_%H%M`@gmail.com -t -u " laptop Restart" -m " Started on > "`date +%Y%b%a%d_%H%M` -s smtpauth..net -xu -xp
----------------------------------
Natty seems to connect before login by default. I don't want it to. It adds approx 15 seconds to my boot time.
ReplyDeleteIt works beautifully but my next problem is: since there is no network-manager under gnome, when my netbook comes back from sleep there is no way to re-connect. Logout-then-re-login does not work either. I have to restart the netbook. I must be doing something wrong.
ReplyDeleteI had the same issue until I checked on "Available to all users" option which works fine for me.
ReplyDeleteHey i think of your blog is pretty - i found it pleasant in google and I put on my list of favorites would like to see more posts from u soon.
ReplyDelete