Generate Secure Passwords Using Built-in Tools on macOS, Windows, and Ubuntu

Sabito - Jul 31 - - Dev Community

In today's computing environment, password security is paramount. Different operating systems offer their own tools to generate complex passwords. This article will show you how to use built-in tools on macOS, Windows, and Ubuntu to create secure passwords.

How to Generate Complex Passwords on macOS

Terminal:

  • Use the openssl command to generate a random password:

     openssl rand -base64 16
    

For convenience, you can further package this method into a right-click shortcut using Automator

Automator:

  • Open Automator (found in “Applications”).
  • Choose the “Service” template.
  • Search for and add the “Run Shell Script” action, then paste the following script:

     /usr/bin/openssl rand -base64 16
    
  • Save the service, naming it “Generate Random Password.” You can then use it by right-clicking and selecting “Services” -> “Generate Random Password.”

How to Generate Complex Passwords on Windows

PowerShell:

  • Open PowerShell.
  • Use the following command to generate a random password:

     Add-Type -AssemblyName System.Web
     [System.Web.Security.Membership]::GeneratePassword(16,3)
    

Command Prompt:

  • Use the certutil command to generate random data and convert it to base64:

     certutil -encodehex -f nul - 48 | findstr /v /c:"CertUtil" /c:"48 bytes" /c:"\---" | powershell -Command "$input | ForEach-Object { $_.Trim() }" | out-string | format-hex -u
    

How to Generate Complex Passwords on Ubuntu

OpenSSL:

  • Use the openssl command to generate a random password:

     openssl rand -base64 16
    

/dev/urandom:

  • Use /dev/urandom to generate random data and convert it to base64:

     < /dev/urandom tr -dc A-Za-z0-9 | head -c 16 ; echo ''
    

By using these built-in tools, you can easily generate complex passwords and ensure your accounts are secure.

. . . . . . .
Terabox Video Player