Now let's examine how to manage access to the root account. In Linux,
we already saw one method to temporarily become root whenever needed
when we run a command such as this.
It's basically the same as the root user saying, execute LS root
pseudo dash I. And that's it. We're logged in as root to exit from the roots session.
We'll type
su dash
if root had a password set in the past.
But then the account was locked for some reason, we can unlock it with this command
after one of these steps, then we can run su
and type the password for root to log in.
Of course, we would also find ourselves in the reverse scenario.
Imagine this,
let's say that currently people can log in as root,
but we decide that this is a bit insecure for our purposes.
We can lock password based logins to the root account
with this
or pseudo password dash L root.
Other logins might still be possible if they were previously set up.
For example, if an administrator has set up logins with an SSH private key,
they'll still be able to log in. Even if the root account is locked
since that method does not use a password but a cryptographic key instead.