OK so now we're going to cover users and privileges.
So in the last video we touched a little bit on privileges with our allies dash L.A. and we touched
a little bit on users by changing the password of our route account.
So now we'll cover a few more commands regarding those.
So if we look again at s dash L.A.
You could see all this crazy jumbled word EJ over here right.
So it actually means something so we look at the first line here.
If we see a dash like this a hyphen that means it's a file if we see a D.
That means it's actually a directory and then you see our w an X so RW an X actually means read write
execute.
It's the permission settings that this particular group has.
Now there are three groups here.
There's the first second and then your third right here.
Right.
So your first group right here is the owner of the file.
So it looks like the owner of the file has full read right execution.
Right.
And then the next set of three here is actually the permissions for the members of the group that own
the file.
So this is a group ownership as opposed to actual ownership here.
So for the people that are in the group that has access to this file they can only read and execute.
They can't write to it.
Now for the last one this is just all of their users.
So any common user here can actually just read and execute.
They can't write the document.
So that comes into play especially when we get into penetration testing because of penetration testing.
We're looking to have full access right.
So we're always going to be looking for that folder that has full read.
Right.
Typically if we look at temp that's our temp folder a lot of times you see the temple there has full
read write execute.
So when we're doing penetration testing we're trying to upload some sort of exploit.
We might actually upload it into the temp folder because that's where we can execute those those files.
However we could also be looking for other full read write execute files where we need to modify them
and give us root access to a system.
So it's all about insecure configurations.
And we're going to cover that more once we get into the actual penetration testing part of the course.
So for the Linux essentials part of the course all we need to worry about is these file permissions.
Another important feature of that is if we were to create a script or scripts actually be to run until
it has full access.
So how do we change access here.
So let's make a file.
I'm just going to make will just echo another text document right.
So we'll just say hello.
And actually I type that it backwards.
So hello.
And we'll call it.
Hello.
Text slightly less here by default.
We only have read write and then read access for everybody else.
Meaning if we wanted to read it we could say cat which we're going to get into later.
Cat hollowed out texts and it just says hello.
So what can we do here where we can use something called change mode in changing mode is C H emoji and
we have a couple options here so we can do a plus.
Right.
And we could say well we want read write execute or we just want execute.
But another way I like doing it is you have a number feature.
So the one you really need to know is all sevens sevens gives you full read write access across the
board.
So if we say C H mod seven seven seven hollowed out text.
Now we l s L.A. and you notice that.
Hello.
That text turns green.
That means it is full read right.
And here you go.
We've got the dash here saying it's a file and we've got read write execute across the board.
So this is how we change file permissions.
You don't need to necessarily know about the other numbers in terms of penetration testing it becomes
more in terms of configuration and security management of files if you were to get down that path.
So to stay on the easiest path just remember seven seven seven or plus X will work as well.
So changing the mode is is critical and we're going to cover it time and time again throughout the course.
Once we get a little bit deeper.
So a couple more things we need to talk about.
Say we wanted to add a new user.
Well there's a feature called add user so we say add user and one or two names is allowed.
So we need to add a user a John.
OK.
So it made something for John.
Let's give him a password given password again and we'll just hit enter for the defaults.
It's all correct.
So we now have a user named John and we can confirm that we can actually cat the Etsy password file
here and you see down at the very bottom we have this user John.
So this Etsy password file you're going to become very familiar with because it shows you all the users.
Now this will this lot of times are you doing penetration testing you're going to have access is Etsy
pass her file because it doesn't provide the password anymore.
It used to a long time ago.
Passwords are now in the shadow file so you actually have a little bit of access and information disclosure
here at the hands of poor configuration.
So you see that I've created a user John.
Well that gives us a little bit more information.
Say there's SSA each on a machine or something else.
We can use that user name of John to try to break into the machine.
So we'll cover that again later.
But if we wanted to see what the Etsy shadow file looks like now we come in here and you've got these
these jumbled stuff here right.
So it's just a hashing format.
So what we're doing is we can actually use a tool like hash cat to break this down and crack these passwords.
Now a password a password will be very easy but just know that if you have access to the Etsy shadow
file you have a good chance of cracking a password depending on your capabilities and depending on the
strength of the password that allow you access to a machine.
So something to think about their OK.
So now we have our user John.
Let's go ahead and switch to him so we can use something called SMU which stands for switch user will
say switch user John OK.
So automatically gave us John here.
Let's see if we could switch back to root.
We can't just switch back to root because we need root's password.
So we can type in password and that works.
But if we didn't know the password then we'd be stuck on John.
We are able to access John because we were already rude.
So this comes into play in terms of users.
Let's go back to John here
now.
If you're a user you have to be able to do certain things you need permission to do certain things I
should say right.
So root has full access and permission to do everything.
But John we just created John.
John doesn't have any sort of access.
So if we wanted to if we wanted to change the password say we want to change the password for four root
I can't modify the password information because I don't have that kind of access.
Now there is something called a pseudo which would provide John the access if we gave it to him.
So it's called a pseudo source file and basically anybody in that pseudo worse file can change permissions
given if they are a pseudo user.
Right.
So we would type in pseudo password root and it's going to ask for the password for John but you're
going to notice a John's not in the pseudo ours file.
John can't do this.
So John has base permissions right.
And we're going to counter that a lot of times and penetration testing where if we get in we'll get
something called Lower privilege and we'll get it and count like John and we're going to try to escalate
into route but we just can't do it.
You know the chances of doing a doing that and having a John in a pseudo risk file is just not high.
It's possible but it's not likely.
So for now just know that if you want a user other than route to have access to file permissions you
need to have them in the pseudo file that becomes useful to penetration testing because you can look
at the sewers file if you have access to see what users have sudo privileges OK.
So that is it for this lesson and the next lesson we're going to be covering network commands and moving
on gradually towards scripting.
So let's go ahead and get there and I will see you when we get over there.