LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-20-2004, 06:32 AM   #1
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Rep: Reputation: 30
Question How to configure Wireless KEY automatically?


Hello,

I've an access point using WEP and every time I run linux I have to login as root and use iwconfig for provifind the HeXKey. How could I do it automatically in every startup?

Maybe it matters: I'm ussing Knoppix 3.4...

Thank you very much in advance...

PS: It looks like I'll never stop asking things. Just hope answers won't stop either. :-)
 
Old 11-20-2004, 08:55 AM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,790
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
In slackware you would just add the command to your /etc/rc.d/rc.local file. I know Knoppix has something similar. Try looking in your /etc/init.d directory. That should contain files that are executed at boot time with root privileges.
 
Old 11-20-2004, 09:34 AM   #3
e11
Member
 
Registered: Oct 2004
Distribution: Debian
Posts: 84

Rep: Reputation: 15
Hi, you mean your WEP key isn't fix?


Regards,

Edwin
 
Old 11-21-2004, 01:31 PM   #4
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Original Poster
Rep: Reputation: 30
Hi

No, no... the key is fixed, but I do not know where I have to provide it in order to configure it properly.

On the other hand, I've noticed that sometimes Knoppix does not detect my card. My only solution in that case is to reboot the system. Is there is a way to add it after the boot process?

Thak you...
 
Old 11-21-2004, 02:55 PM   #5
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,790
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
I suppose you could just write a script that loads any modules then configures the card. You could then su to root and run it when you need your card.
 
Old 11-22-2004, 05:35 AM   #6
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Original Poster
Rep: Reputation: 30
HI...

Well, that's what I did, but I wonder if now I can make the script run in every startup, without need using "su"...

:-(
 
Old 11-22-2004, 08:03 AM   #7
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,790
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
Quote:
Originally posted by enemorales
HI...

Well, that's what I did, but I wonder if now I can make the script run in every startup, without need using "su"...

:-(
OK, well that gets back to my original answer.....Knoppix has a directory called /etc/init.d which contains files that are run at start-up. If you add your script to that directory, change its ownership to root, make it executable, and then call it from one of the start-up scripts, it should work. There should be a file similar to Slackware's rc.local that is called at the end of the boot sequence. Calling your script from there is as close as you can get to having it run "after the boot process". The other thing to investigate is which step causes the script to fail. For example, sometimes loading a module can take a second or two. Adding a sleep X command to the script (and replacing X with the number of seconds you want it to wait) can solve the problem sometimes.
 
Old 11-24-2004, 03:30 AM   #8
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Original Poster
Rep: Reputation: 30
Thank you. I wrote a script and put it in /etc/init.d. Then I use "Sys-V-Init Editor" and ask it to load my protocol in several run-levels. I have modified the script so it configures the network at home (when it detects my acces point address, it provides the WEP key) or for the office, where there is no WEP encryption. I'm posting it here, because it could be useful for another person:

Code:
#!/usr/bin/perl

# myaccesspoint.pl
# Looks for my home access point and provides my WEP key if it is found.
# Otherwise, it disables WEP key

# Some "configurations"
# My card device
$card = "eth0";
# access point address
$AP = "xx:xx:xx:xx:xx";
# WEP KEY
$WEP = "yyyyyyyyyyyyyy";

# Checks for the access point
open( CHECK,"iwlist $card scan | grep $AP |" );

if(<CHECK>) {
  # Provides WEP key if my access point is found
  print STDERR "Configuring network with WEP key\n";
  system "iwconfig $card key $WEP";
} else {
   # Configures wireless network without key if my access point is not found
  print STDERR "Configuring network without WEP\n";
  system "iwconfig $card key off";
}

# Asks for IP (I have DHCP in both places).
print STDERR "Pumping for an IP\n";
system "pump -i $card";
Probably is not the best way to do it, but for me at least i works...

Last edited by enemorales; 11-24-2004 at 03:32 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I automatically make a ssh key? cereal83 Linux - Security 11 09-20-2005 02:16 PM
How do I get X to automatically configure/re-configure at boot? BaptismOfFire Linux - Hardware 4 08-08-2005 09:37 AM
Setting WEP Key automatically in Sarge 0ddba11 Debian 1 11-28-2004 09:34 AM
Num lock key went off automatically reaky Linux - Software 2 06-07-2004 06:15 AM
When i press tab key on my rh7.3 i was logged out automatically. nbalu Linux - Software 1 11-14-2003 03:58 PM


All times are GMT -5. The time now is 09:56 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration