Hello everybody and welcome to this tutorial.
This is a follow-up, so let's just go ahead and jump right in
and continue from where I left off in the previous tutorial.
Anyway, one of the first things that you will need to do is type in
chmod -Rv /var/www/DVWA - 1.0.8
Go ahead and press ENTER
Oh yeah, chmod does require you to actually give it a mod, so 777
Just go ahead and give it a global mod.
Let me just show you the command one more time.
Let's make it a bit clearer
Excellent
So this is the command that you need to type in, in order to change the mod of your folder.
We are doing this so that we may actually see it here.
If we don't this, we won't actually see it here.
Giving the global mode of 777 is a pretty bad idea
but considering that we are running this server locally, nobody really cares
because nobody actually from outside has access to this
and it really doesn't matter, since you are the only person with access to this particular web server.
Anyway, go ahead and click on it.
You will immediately get this thing here
and it says "Unable to connect to the databas. mysql_error"
Click here to set up the database.
Go ahead and click on it.
It says "Backend Database: MySQL"
Whoops, what does it say here?
"Could not connect to the database - please check the config file"
Okay, the web app is actually right.
We should check the config file to pass in some additional parameters
but aside from that, we will need to actually get our SQL server up and running.
Go ahead and type in
apt -cache search mysql | grep -i database | less
Now I'm piping it into "less" so that it would stop after a first screen full
and then I'm gonna scroll down manually through the rest of the packages.
Excellent!
So what do we got here?
Anything that we need?
You might think that this is what you need, but no.
We are looking for a client
Probably should have written a client, but it doesn't really matter
I can find it here.
There we go
It says "mysql - client"
Go ahead and copy that name
Press U to exit this
Type in "apt - get install mysql - client"
The server is already installed, if I'm not mistaken
and there we go.
It's done
If the server is not installed, you can do this as well, just in case
server, press ENTER
and there we go.
So this command that I have selected here, you can run it through just in case
and you need to run this command, the second one that I've selected, as well.
I hope that is clear enough.
That way, we will be able to access our SQL server.
Now what we need to do is type in "service mysql start"
Yep, there we go
"starting MySQL database server: mysqld already running"
So what I can do here is type in "restart"
stopping, starting, and there we go.
Okay, so no problems there.
I've been doing some tampering with it.
So it just did some cleaning up work for me, no big deal there.
Anyway, you will need this command - service mysql start
It will not be started by default.
As I said, I've been tampering with it, so it's already up and running on my system
primarily because I need to test things out before I actually showed them to you
Now go ahead and clear the screen.
You can type in "mysql -h localhost -u root -p"
Now if you're doing this the first time around
if you haven't done any configuration to the SQL database, you will not use the "p" parameter.
So no p parameter
You will delete it and this is what you will type in
I'm gonna get an error saying "Access denied" because I am using a password
and it says here "using password: NO"
because I haven't passed any password parameters
but if you are running it for the first time, this is the command which you need to use --
mysql -h localhost -u root
without any password parameters
because I've already set the password.
I am going to type in "-p" for password argument
and I'm going to take my passport here, and there we go.
It's up and running
I can actually connect to it without any problems.
I'm currently using the MySQL database.
This is what you type in the second time around
when you actually set the password.
You just type in "-p" for password argument
and if you're running it the first time around, you just type in this command.
I don't want to reiterate it again.
I hope you got that part.
If you didn't, feel free to ask me pretty much anything you wish in the discussion section on Udemy.
Anyway, the mysql command syntax is a lot different from the Linux one.
For example, you don't have clear
and you need to put semicolons at the end of your statements for them to take effect.
Now I have prepared a small list of commands here for us to use today.
I want you to take a look at them
Let's just...Ugh, come on. Don't do this to me
Font...Give me 16
Okay, so now you can see it a bit better.
This is the command that you need to run.
So you can type in any password you wish here.
I'm gonna go ahead and type in "test", as this machine is primarily for testing purposes.
I would suggest that you type in something relatively complex.
If you really want to be secure and stuff like that
you can type in eight characters with all sorts of things, like thoughts, @ signs
no words from English dictionary or anything of a kind
but again, don't emphasize security too much now
primarily because this is a virtual machine and only you have access to it
and only you will be using this SQL Server
and I really don't think there is a need to type in anything super complex here.
I am using the password "test", although after the end of this tutorial
I am probably gonna delete this machine all together.
Anyway, this is the command which you need to use.
Capital letters are not mandatory, but they're quite nice if you want to have a good layout of the syntax.
If you type in this with lower case letters, this command is gonna work just fine as well.
I'm gonna do this without the semicolon, just to show you what happens
So copy, and paste it here
Basically like English language that says set password
It says "SET PASSWORD FOR root@localhost=PASSWORD( 'test' )
The quotation marks are not part of the password.
In between the quotation marks, you will type your password in.
So if I press ENTER, nothing's gonna happen.
It's just gonna move on to the second line and wait for a second set of commands
but you can either pass different or additional parameters here.
For the time being, I'm not gonna do that.
I just want a simple password for my MySQL database and that's it.
You can check it out in the advanced setting passwords for MySQL databases
You will see that you can pass in a ton load of parameters
ranging from encryption to substituting old passwords with new ones
and so on and so forth.
For the time being, I'm just gonna semicolon
but if you want to pass some additional arguments you could type them in here.
If not, type in the semicolon, press ENTER
and it's gonna finish it
It says "Query OK, 0 rows affected"
because I already have the password set to "test"
I would love to be able to clear the screen.
I do believe that there is a command for that somewhere around here you
but you cannot use clear.
That's just what I want to do emphasize here.
Anyway, now that we the password set up
I'm gonna type in "exit" and I'm gonna go back to my website to see
Okay "Could not connect to the database - please check the config file"
Excellent
Now we need to clear the screen.
Go ahead and change your working directory to "cd /var/www/DVWA - 1.0.8"
Where is the config file?
Here it is -- The first row
So "cd/config
Let's see what's in the config file.
It's a php file
Excellent
So just type in "nano config"
and scroll down.
You will see here, it says "[ 'db_server' ] = 'localhost'; "
database...dvwa
Okay, you can leave that. That's gonna get created.
db_user, root
This is definitely not our password.
We need to type in "test"
Whoa, whoa, whoa...that's not what I want to do.
Let me just move here.
Delete this password
Type in "test", CRTL O to save it, and CTRL X to exit.
There are other ways of authentication
but we're just going to use this simple password for the time being.
Now I have noticed that, since I have created this new user test for myself in a Kali Linux
there have been people in the discussion section who have been complaining about the permissions problem.
Just make sure that you are root
So whatever you doing of this nature or kind
and if you're configuring passwords or editing these sort of files
make sure that you are root.
You become root by typing "su"
Okay, let me just go ahead and exit
Excellent
So I am now test@kali
and if I type in "su", I get prompted for a password
and if type in "test"
Oh, come on
Excellent
I type in my password, and it's root@kali
I become root
Though it may seem strange to some people
because I'm giving up my password here
but as I said, it's a virtual machine that I am going delete after this tutorial is done
so it doesn't really matter to me at all.
I haven't even tuned the security precautions of this machine.
To a large extent, I have created real-time circumstances, but most of my passwords are like this.
So they're pretty weak and they can be busted really fast.
Fortunately for me, nobody from outside world has access to this machine.
Anyway, go ahead and clear the screen.
Now it did tell me that some services have stopped
I'm just gonna type in "service mysql status"
Is it running?
Okay, so it has threads. I guess it's running.
Okay, it is running.
It's a little bit different in Fedora.
It actually tells you immediately if it's active or running.
I'm sure it's says somewhere in this text that as well, but it has threats, I guess it is running.
Anyway, just go ahead and clear the screen. .
Now "service apache2 restart"
Excellent
So it says that it "Could not reliably determine the server's fully qualified domain name"
It doesn't really matter
That's not an error. That's a warning.
Go back to your site and it says "Create database"
Excellent
So you see, "Database has been created"
" 'users' table was created"
"Data inserted in 'users' table"
Guestbook data inserted
Successful!
No problems, it runs smoothly.
If you have any problems concerning this procedure, before you post the question
I would advise, if you get an error of some sort, or something of a kind
Copy/Paste the error immediately.
Don't wait for me to ask for the error.
You will save a lot of time by just copying the error immediately, so I can see what the problem is
and my first reply doesn't need to be copy the error and then you wait
and then you copy the error and then you wait again
and then I give you a reply.
Rather instead, copy the error immediately
so that my first reply can be "Oh, you need to do this..."
and then you do it and solve the problems for yourself, making it a far faster method.
Anyway, here I'm going to conclude this tutorial
and we're gonna continue off in the next one.
Until then, I bid you farewell and wish you a lot of success.