SysTutorials Forums QA How to generate a password in Shell on Linux?

Admins usually need to generate some passwords for others, such as when creating a new user in a Linux system. How to generate a password in Shell on Linux?

Several possible and short methods. Here, we generate a password of length 8.

Using pwgen:

$ pwgen 8 1
dao3PaW9

Password based on base64 (note that the encoding of a 6 char string will be 8 chars in base64) with random numbers generated from various ways.

Using gpg:

$ gpg --gen-random -armor 1 6
eXDvMVq2

Using openssl:

$ openssl rand -base64 6
1E8oiu5G

Using Linux' /dev/urandom:

$  head -c 6 /dev/urandom | base64
Ilna5Pj8

There are possibly more.

  • This reply was modified 3 months, 2 weeks ago by  Admins.
  • This reply was modified 3 months, 2 weeks ago by  Admins.
  • This reply was modified 3 months, 2 weeks ago by  Admins.
  • This reply was modified 3 months, 2 weeks ago by  Admins.
Reply To: How to generate a password in Shell on Linux?
Your information:





<a href="" title="" rel="" target=""> <blockquote cite=""> <code> <pre> <em> <strong> <del datetime=""> <ul> <ol start=""> <li> <img src="" border="" alt="" height="" width="">

Please share if you like this post: