DEV Community

Sabito
Sabito

Posted on

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

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.

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay