Hello, and welcome to this Pluralsight presentation.
My name is Andrew Mallett, and I'm going to be here as your instructor
guiding you through the module, where we take a look at managing local
users. As we navigate our way through, we're going to be taking a look
at, well, local user management, which is all about, of course, managing
our users, but these can be local users, local to the system in the
etc/passwd file.
But we'll also introduce the idea of identity management,
although we won't look at it in this section. We're
concentrating on local accounts.
We'll be taking a look at managing groups.
Again,
these are going to be local groups local to our system, as well as
then managing our passwords for our user accounts.
So when you're sat comfortably,
have a nice cookie and a coffee right by your side, then we are going to begin.
We need to take a look at the lab system that we're using.
This is all getting you ready for our CompTIA Linux+
certification, and working with that,
we can have Ubuntu, Red Hat or SUSE machines, and we're using
AlmaLinux 8.5, a CentOS or Red Hat 8 clone.
We're running this inside of Vagrant and the VirtualBox hypervisor.
We begin by, of course, listing our user accounts, what users do we have on our
system already. And those user accounts are local user accounts we're going to
find within the etc/passwd. Passwd is for passwords, but don't expect to find
passwords in this file, it's more of a legacy term from when passwords were
often stored in the one file.
We can just use our command grep to be able to search for the user account.
This is one way, but there is probably a better way. Using the getent
command, we can search to the entire password database.
Now this could be local,
but it could also be pointing through to one of our identity systems.
And with the one command, we can go through and search for our user vagrant.
So this is a more clever way of doing it, because it's
listing not just local accounts,
it's listing our identity accounts, but also allowing us to do
the search embedded into the one command.
If we needed help on the fields that we find within the password file,
then using man 5, 5, remember, is the configuration setting for our
files so we'll be able to get the definitions of each of our fields,
then do so with your glorious man command.
Now we've introduced the idea of the getent command. Behind getent,
we have the file /etc/ns, name service, switch.conf. This then
tells the command where to locate its entries. Now by default it's
our local passwd file, but it could also be pointing through into
an identity vault.
These then have our central user account, which could be things like
Microsoft's Active Directory or OpenLDAP, and then having user accounts
that we can use across multiple servers rather than an account on every
single server that we need to authenticate to.
Other ways that we can filter our information.
We could use the cut command, either by looking at the password
file or by cutting information that we receive from standard
output using the getent command. Fields 1 and 3 would be our
user name and our user ID.
The password separator is the colon.
If we wanted the Big Brother,
then we could upgrade our command and our knowledge to the awk
command. Here we can actually carry out the search for the
vagrant user and the fields all in one.
So it's getting used to some of the commands that are available to you and
becoming familiar with these wonderful tools. Familiar with these
wonderful tools? What is the best way to do that?
I think by using them.
Shall we try using them? Yes, I think so.