1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Setting wireless password programatically

Discussion in 'Tomato Firmware' started by AndrewX192, Nov 10, 2013.

  1. AndrewX192

    AndrewX192 Reformed Router Member

    I have a script that changes a password on one of my wireless networks so that it can be controlled independently of the main administration portal. It used to a work on DD-WRT, but not TomatoUSB. Here's the procedure the script follows:

    nvram set wl0.1_wpa_psk=$PASSWORD
    nvram set wl1.1_wpa_psk=$PASSWORD
    nvram commit
    service wireless restart

    The new password is reflected in the tomatousb administration portal, but guests are unable to connect to the network (they receive a message about the WPA key not matching).

    Simply saving the configuration in the tomatousb portal is enough to make this work. I've tried things like wl down/up and rebooting the device to no avail.
  2. mvsgeek

    mvsgeek Addicted to LI Member

    I can't test with a USB-enabled router, but this works for me on an Asus RT-N12 B1 running Tomato Firmware v1.28.0502 MIPSR2Toastman-RT-N K26 Std :

    root@tcb0451:/tmp/home/root# nvram find wpa_psk

    And just to verify that we find all occurrences :

    root@tcb0451:/tmp/home/root# nvram find old_password

    Change the password :

    nvram set wl0_wpa_psk=new_password
    nvram commit
    service wireless restart

    On a Windows client I then disconnected and re-connected with the new password. My nvram doesn't have the wl0.1 or wl1.1 variables. Perhaps you should be setting wl0_wpa_psk instead?
  3. dbernsee

    dbernsee New Member Member

    Don't know if it's important after so many years...anyhow i had the same problem an i fixed it!

    i used the following instruction to change daily wpa key and mail it
    google > Daily WPA passphrase changer (DD-WRT Forum)

    My Problem was that i created a password list under windows <cr> and i have to convert it first via awk under linux to get it working!
    awk '{ sub("\r$", ""); print }' winfile.txt > unixfile.txt

    maybe your problem is diffrent but you have to try the commandos seperatly via ssh
    nvram unset wl0.1_wpa_password
    nvram set wl0.1_wpa_password=(input directly to test it...no var!)
    nvram commit

    service wireless restart
    if this doesn't work...u'll have definitely a diffrent problem!


    p.s.: sorry for my bad english
    Last edited: Jun 26, 2015
  4. remlei

    remlei Networkin' Nut Member

    I think it's normal to get disconnected with an error with passphrase is not match. I mean, you changed your passphrase on your WiFi, so you need to change it on your WiFi devices as well, thats no brainer.

Share This Page