Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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. :-)
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.
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?
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.