iwconfig wlan0 set s:passphrase

It only works on WEP. WPA is not supported.
You need to install wicd or wpa_supplicant.
Edit the /etc/network/interfaces and remove any references to wlan0


#apt-get install wicd
$wicd-client

more