[Part 6]Kali Linux Basics: Starting and Stopping Kali Services
This topic continue back from Part 5 Kali Linux Basics. In this lesson, we are going to discuss about the starting and stopping Kali Services. Let’s have a look in the commands and dive into the command lines.
Commands that we be learning:
- services
- systemctl
Let’s talk about the starting and stopping services when we are in the Kali Linux. There are couple different ways that we can start and stop services. So, when I’m talking about services, i referred to something like web server, SSH or a sequel database. In this lesson, I’m going to show you a few different services and how to start them and stop them. We are going to talk about which services are important to keep on boot, which services are important to start them when you feel that you want to or start them when you need them ,etc.
First commands: services
Example: Apache 2 (web server)
First, type in and hit enter the command ifconfig and copy the IPV4 address. Then, I will go to the web browser(FireFox) and paste the address. Now, you will notice that it’s unable to connect. This is expected here because we are not running a web server now.
Next, we type in the sudo service apache2 start and hit enter. Look like it’s just went through and apache2 debian default page has been loaded in the web browser. When we boot our machine, this apache2 service is not running by default. Then, if we want to run a web page then we actually have to start up the service for it to work which is shown in previous figure.
If we want to add or place files, we are going to edit var/www/html/ folder. If we want to host a malicious webpage, we want to upload something to a machine that might be malicious, a file that we want to transfer to someone else or download on another computer doesn’t have to be malicious, we can host that file in this folder here. This is one way of doing it. There is a much easier way and I’m going to show you.
In this method, I will create a file called cat.txt file. We can easily spin up a web server with command: sudo python -m SimpleHTTPServer 80 (m for module, 80 for port). However, the port 80 has been used for apache server for the moment. Now, we will use port 8080 instead of port 80. When we put in the IP address with port 8080, it shows up the directory. Actually, I can go to the file and get it. In addition, there is information in real time whether or not the file was captured. In conclusion, this is a web server that’s so easy to spin up and put it in the directory i wanted to. For instance, if I want to spin up the desktop directory, I would navigate to desktop and spin up the python module. Thus, I don’t have to put the file into the var folder and it just make life so simple.
We can stop the apache2 service with command: sudo service apache2 stop. Now, you can see the service is stop.
Command: systemctl
Spin up/ Start a service permanently
Let’s say that we just had the apache2 running and then we rebooted the machine. When we reboot our machine, apache2 is not going to be online because we do a service start and it only remains on this session. Once we reboot, that session or service is disappeared. If we want to keep the service online whole time, we can use systemctl to do so.
Postgresql is going to be a database. Since we have enabled the postgresql, it will load every single time the machine reboot. Why this is important? This is important because it’s going to allow us to run Metasploit and have the postgresql database running when we boot. Thus, we don’t need to take extra time to load the Metasploit.
The figure above, it shows that the database appears to be already configured and skip initialization because we already enable the postgresql. Therefore, the systemctl command will save a little bit of time as the Metasploit will take some time to run. This is a feature that doesn’t hurt to be enabled on your system boot.
Thanks for reading
To be continued…next lesson is related to installing and updating tools