Hi, this is Gary with MacMost.com. Today let me show you three ways
to create random passwords on your Mac without using Safari.
MacMost is brought to you thanks to a great group of more than 1000 supporters. Go to
MacMost.com/patreon. There you can read more about
the Patreon Campaign. Join us and get exclusive content and course discounts.
So in my recent security videos I talked about using either Safari or a third party password
manager to have random passwords. Not only will a password manager allow you to store
your passwords but when you signup for a new site or create a new password for an existing site
you can generate random passwords to use. Random passwords are what you should be using.
But what if you're not in Safari or even in a web browser when creating
a password. What if you're using an app or something or in some situation
where you can't generate a new password using either Safari or a password manager.
Well, there are several ways to generate truly random passwords on your Mac. The first one is
to use an app that you have on your Mac called Keychain Access. This is an app that specifically
deals with a keychain. What you have in Safari that stores your passwords. But we're not going
to actually use any of that normal functionality. We're just going to use it to generate a new
password. So I'm going to use Spotlight here to search for Keychain Access and I'm going to run
it. Now you're going to see a lot of information here about all of the different items you have in
Keychain. Don't worry about that. We're not using that at all. Instead we're going to go to File
and then say New Password item. This will allow you to generate a new item in Keychain. But
we're not going to use this either. The only reason we went here is to access this little
button. Click this little key button here and it comes up with something called the Password
Assistant. This will generate random passwords. It will put one there right away and you can
set that type to Letters & Numbers, Numbers Only, Random, or Meeting a Certain Standard.
We'll stick with Letters & Numbers and you could change the length to be whatever you want.
Then just Select again to have it regenerate a password. Then when you get what you want
you could simply Copy from here and Paste it into whatever you're using or just leave this window up
and go into a window in another app and type it. Of course this doesn't save your password. You're
going to have to Save this. Somehow write it down. Save it in your Password Manager.
But it is handy when you need to create a password and no other method is working.
Now as you might expect you can also use the Terminal to do this. I'm actually going to show
you a few Commands. So launch Terminal and first let's start with a very short simple Command.
This Command here will generate the date and then pipe it through an app that's going to
create what's called a Checksum. Basically it's going to create a bunch of random numbers and
letters that are based on the actual time right now all the way down to the second. So you can
see it generates a whole bunch of different characters here. You could just take what you
want. If you only want to use a certain number of characters at the beginning you can grab that.
You're only going to get some letters here all the way up to f since this is a hexadecimal value. But
this will do if you need something quick. Note that in Terminal you could always use the up
arrow to repeat the last command and hit return. So I can keep generating passwords this way.
Here's something a little more involved. This command is actually going to use the open SSL
app in Terminal and it has a random function. It's going to generate a base 64 random number
and you're going to get something that looks like this. So it's going to use
upper and lower case letters and numbers. This is also handy for some quick passwords.
Now here's one that's far more involved but much more useful. This long command here is actually
going to use the urandom binary that's in the developer folder to create the random number.
But it's going to go and assign the values to the characters that are here. So we have a to z,
A to Z uppercase, zero to 9, and then dash underscore and the dollar sign. There has to
be a backslash in front of the dollar sign. So if you don't want to have say the underscore and
dollar sign you can remove these three characters here and you'll only get the letters, numbers,
and an occasional dash. Then here is the length of the password. So we get that password there.
I'll use the up arrow to generate another one. I'll use the up arrow again but this time I'll
go and Edit it so it generates twelve characters. Obviously this is hard to type so you're probably
going to want to Copy this and place it somewhere where you can easily access this. Put it in
a Note or Text file or something so you could always just paste it into Terminal and use it.
How about using Automator to do this? After all if you can program something in the Terminal you
certainly should be able to program something in Automator. Let's create something quick here. I'm
going to create a Quick Action but you could do an Application as well and I'm going to add a bit
of JAVAscript. So I'll put that in here and then I'll add some JAVAscript. So what this code does
is it declares a variable here and it puts all of the different characters that we want to use
in passwords in here. Then it starts off with a password that's blank and it's going to loop
eight times. So if you want to have more than 8 characters just change the number right here.
It's going to add one character at a time and it's going to grab a character at a position in
here that's a random number based on the length of this string. So it's just basically going to
pick eight random characters from this. Then it's going to Return. We can do something like
Copy to Clipboard after that so whatever comes out of this will then go into the clipboard. So I'll
have TextEdit open here and I'll run this and now when I go and Paste, Command V, you could see it
pastes in an eight character password. I can run it again. Another eight character password. Now
since I've created this as a Quick Action I can set everything here to work, will receive nothing
in any application. I'll Save it to generate random password. Save. Now I've Quit and Restarted
TextEdit and when I go into the Services Menu I can see right here Generate Random Password. I
do that and now I can Paste and I get the password there. So it's kind of a handy little thing I've
created. Of course, hopefully you don't need to create random passwords outside of Safari or
your Password Manager that often that you need to create a Quick Action. You could always just run
this inside of Automator in the odd case that you actually need a password to be created like this.
I hope you found this useful. Thanks for watching.