Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I generate a new random wpa/wap2 key in the linux terminal? I tried pwgen but this is not generating hexadecimal values.

share|improve this question
For WPA(2) I would use all regular characters to generate from rather than just hexadecimal ones. What is your reason to generate a password from such a selected set? – gertvdijk Jan 14 '13 at 13:39
@gertvdijk this is required by the router – danny Jan 14 '13 at 14:22

For instance, if you want a password with the maximum character length, i.e. 63, you can enter either of the following 2 commands:

  1. makepasswd --chars=63

  2. openssl rand -base64 63

share|improve this answer
thanks for your answer, but I need to generate a 64 characters long, hexadecimal password, which is required by my router. – danny Jan 14 '13 at 14:38
then you need openssl rand -hex 32 – Jean-Marie Jan 15 '13 at 14:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.