top of page
Search
  • Writer's pictureFrank Yoo

Random passwords, out of ideas?

There is something about passwords. If you're relying on some password manager (and if you aren't already using one, then suggest you search for one :D) then you'd be aware password managers can generate random passwords for you.


But there are times where you might just need a "temporary fix" (or worse don't have a password manager on a server that you SSH through), and you're running out of random ideas to quickly come up with something decently secure. Worse, if you rely on tiling manager on Linux like I do (bspwm, i3, etc...), sometimes it's quicker to fire up a terminal than switching to a web browser.


So, here are some tips.


 

Essentially, we're creating a random password on-demand using simple command line available on your personal device.


For Windows, fire up PowerShell. Once you're in PowerShell, type:

PS C:\> Add-Type -AssemblyName 'System.Web'

PS C:\> $password = [System.Web.Security.Membership]::GeneratePassword(<length>, <number of non-alphanum characters>)

PS C:\> $password
<output>

Save either in your profile or you can save this as a ps1 file to load when needed.


For Linux or Mac, I would suggest you set this up as an alias in your .profile / .bashrc / .zshrc:

$ cat ~/.zshrc | grep rng
rng='dd if=/dev/urandom bs=1 count=<length> 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev'
  • <length>: the length of your password


Hopefully useful for someone who needs a quick and dirty way to create a complex enough password for temporary use.

20 views0 comments

Recent Posts

See All

Comentários


bottom of page