Results 1 to 8 of 8

Thread: Simple script for wpa_supplicant

Hybrid View

  1. #1
    Member
    Join Date
    Jun 2008
    Posts
    101

    Default Simple script for wpa_supplicant

    I recently installed BT3 to my HDD, so I was thinking on a way to run wpa_supplicant automatically! I'm assuming that wpa_supplicant.conf is properly configure and ready to execute when called.

    First create a bash file using an editor, save without extension

    #!/bin/bash
    clear
    ifconfig ath0 up
    echo "starting wpa_supplicant"
    wpa_supplicant -w -D wext -i ath0 -c /etc/wpa_supplicant.conf
    # chmod 755 filename -read,write,exe privileges

    # ./filename -execute the file

    Next, open a terminal and get an ip

    # dhcpcd ath0

    Done! I'm also looking for a way of opening a second terminal in the script in order to execute dhcpcd as well. After that find a way of running this automatically at startup!

    Ideas are welcome. Thx

  2. #2
    Just burned his ISO Niros's Avatar
    Join Date
    May 2007
    Posts
    16

    Default

    By the looks of things it only supports atheros cards. Perfect for the EEEPC however, this is getting added into my modules folder. Thanks for the code

  3. #3
    Member
    Join Date
    Jun 2008
    Posts
    101

    Default

    Yes, my chipset is atheros, but I think you can easily adapt it to any other chipset. I added something extra, -B to run wpa_supplicant deamon in the background, and dhcpcd to get the IP!

    #!/bin/bash
    clear
    echo "turning ath0 interface up..."
    ifconfig ath0 up
    echo "starting wpa_supplicant"
    wpa_supplicant -B -D wext -i ath0 -c /etc/wpa_supplicant.conf
    echo "obtaining ip..."
    dhcpcd ath0

    exit

  4. #4
    Just burned his ISO
    Join Date
    Jul 2008
    Posts
    3

    Default Wireless in Slackware based systems.

    Hi, I'm new to BackTrack but I've been using Slackware for a while now... I know this thread's a bit old, but thought I'd stick my oar in anyway, and hopefully teach somebody something. In Slack 12 (might be slightly different in 12.1), edit /etc/rc.d/rc.inet1.conf and scroll down to the section commented as 'Example config information for wlan0'. All you need to do is uncomment (remove the # at the beginning) each line you will need. For a pretty standard WPA-PSK DHCP setup, you should just need to uncomment IFNAME[4] and change the value to the name of your wifi device (ath0, eth1, wlan0 etc), USE_DHCP[4] (set it to "yes" - lower case). Next uncomment WLAN_ESSID[4] and put in your own... Next up WLAN_MODE[4] - set it to 'Managed'. WLAN_KEY[4] needs to be set to your PSK, and WLAN_WPA[4] should be "wpa_supplicant".

    This should get it all going from startup, as /etc/rc.d/rc.inet1 script runs during startup.

    It may all seem a bit daunting to those new to linux, but you're gonna have to get dirty sooner or later These scripts are really useful to know back to front for anything network related.

    P.S. If you really want to use your own script to connect, then just edit /etc/rc.d/rc.local and add a new line which is the location of your script. That will cause it to run this script as soon as the machine finishes it's init scripts.

    X-T

  5. #5
    Member
    Join Date
    Jun 2008
    Posts
    101

    Default

    Quote Originally Posted by xtothat View Post
    Hi, I'm new to BackTrack but I've been using Slackware for a while now... I know this thread's a bit old, but thought I'd stick my oar in anyway, and hopefully teach somebody something. In Slack 12 (might be slightly different in 12.1), edit /etc/rc.d/rc.inet1.conf and scroll down to the section commented as 'Example config information for wlan0'. All you need to do is uncomment (remove the # at the beginning) each line you will need. For a pretty standard WPA-PSK DHCP setup, you should just need to uncomment IFNAME[4] and change the value to the name of your wifi device (ath0, eth1, wlan0 etc), USE_DHCP[4] (set it to "yes" - lower case). Next uncomment WLAN_ESSID[4] and put in your own... Next up WLAN_MODE[4] - set it to 'Managed'. WLAN_KEY[4] needs to be set to your PSK, and WLAN_WPA[4] should be "wpa_supplicant".

    This should get it all going from startup, as /etc/rc.d/rc.inet1 script runs during startup.

    It may all seem a bit daunting to those new to linux, but you're gonna have to get dirty sooner or later These scripts are really useful to know back to front for anything network related.

    P.S. If you really want to use your own script to connect, then just edit /etc/rc.d/rc.local and add a new line which is the location of your script. That will cause it to run this script as soon as the machine finishes it's init scripts.

    X-T
    Nice, I'll definitely try it out when I have some free time. I'll give you some feedback afterward.

  6. #6
    Just burned his ISO
    Join Date
    Jul 2008
    Posts
    3

    Default Can't wait

    I look forward to your reply!

    X-T

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •