Hello, and a big warm welcome to this presentation from Pluralsight.
My name is Andrew Mallett,
and I'm going to be here as your instructor to help
guide you through the module, Elevating Privileges in Linux.
I'd like to make sure that you're sat comfortably with
a warm beverage close to your side, and we shall begin.
And we're going to be taking a look at how you can become the boss.
Being the boss, managing the system, that's all what we ever wanted to do,
and we're going to show you how you become the boss.
So it's all about our privilege escalations and the
tools that we can use to do this, and these include then the su command,
the sudo command,
also when we're using sudo we can make sure that any of our environment
variables can be carried through if it's okay to do so,
and we'll be taking a look at PolKit, which formally was called PolicyKit.
So when you're ready, sat comfortably, we're going to begin.
Now the user ID in Linux, which is normally the root account,
they're the ones that manage your system.
As we said then using su, sudo, or pkexec,
we can elevate privileges to those of the user ID 0,
and we're going to step you through those processes now.
The first thing we take a look at is the su command, su for substitute user.
So if I just use su by itself with no options or no arguments,
then we are switching to the root account,
but we maintain our current environment variables.
Using su ‑ or su ‑l, they're both exactly the same thing,
we are doing a full log in, so we are starting a new environment for the account.
Again, by not specifying the user,
we're assuming we're moving to the root account.
The final example we've got here is where we're doing a full login,
su ‑, but this time we're specifying the user account,
so we're moving or switching our user account through to bob.
Now with all of these,
we're going to be prompted for the password of the target account.
So that's going to be then our user root in the first three examples
and the password for bob in that fourth example.
The problem is that if we have all of our
administrators knowing the root password,
it's not the greatest of ideas really, is it?
When any of the administrative team leave the organization then presumably
you're going to have to change the root passwords on your system.
You also have no capability of delegating just some commands,
maybe like password management, to a help desk group.
Where we're using su, we switch to the root account,
we are the root account, and we know the root password.
Having said it's not necessarily the greatest of ideas,
it is a method, a method that we can use,
and a method that you're going to be tested upon in the CompTia Linux+ exam. So let's just take a look at how all of this works.