> For the complete documentation index, see [llms.txt](https://cyber-salih.gitbook.io/cyber-salih/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cyber-salih.gitbook.io/cyber-salih/linux/how-to-secure-your-kali-linux-machine.md).

# How to secure your Kali Linux Machine

### Overview&#x20;

[#1.-change-the-default-passwords](#1.-change-the-default-passwords "mention")

[#2.-change-your-ssh-keys](#2.-change-your-ssh-keys "mention")

[#3.-update-upgrade-and-clean-your-machine](#3.-update-upgrade-and-clean-your-machine "mention")

### 1. Change the default passwords

Kali Linux will come with some default passwords out of the box. You will have two accounts to begin with. One account is the 'root' account (Administrator) and the other is the 'Kali' account (user). It is important to change these passwords as every Kali installation will have exactly the same credentials.&#x20;

The default credentials that come out of the box with Kali Linux are:&#x20;

| Account     | Username | Password |
| ----------- | -------- | -------- |
| root/admin  | root     | kali     |
| user/normal | kali     | kali     |

You can see why these passwords are not secure. How we change it is very simple.&#x20;

&#x20;Using the command&#x20;

```
passwd <account>
```

So for example 'passwd root' will allow us to change the password. However, we cannot change the admin password from the Kali account. So firstly we need to switch over to the 'root' account to do all of this.

Commands to do this:&#x20;

![](/files/4t4Fwe20EXFd04ujOXFF)

```
sudo su
```

(then enter the password "kali" - all lowercase)

```
passwd root
```

Press enter&#x20;

![](/files/v4fP1zisq4Wnc7VtGY0N)

```
passwd kali
```

Press enter

### 2. Change your SSH Keys

navigate to SSH key folder

```
cd /etc/ssh/
```

make a folder to put old keys in&#x20;

```
mkdir default_keys
```

move old keys into the folder

```
mv ssh_host_* default_keys
```

Generate some new keys

```
dpkg-reconfigure openssh-server
```

![](/files/hfNmzc4qAPARsenq9ofr)

This has all been done you can validate that this has worked by:

```
md5sum ssh_host*
```

and then&#x20;

```
cd default_keys
```

```
md5sum *
```

and compare the values they should be different

![](/files/WKkFftqXG8opAq3ifLdS)

### 3. Update, Upgrade, and Clean your machine

Update and upgrade in one command by using:

```
apt-get update && apt-get upgrade -y
```

![](/files/EuhCAKlSuMADYltRXAPT)

```
apt-get dist-upgrade -y
```

Then

```
apt-get clean && apt-get autoclean && apt-get autoremove
```

These commands might take a while to run, however, it is important to run these commands regularly and on a fresh install.&#x20;

**Watch the Full Video Guide**

{% embed url="<https://www.youtube.com/watch?v=fOUUah1dKQk>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cyber-salih.gitbook.io/cyber-salih/linux/how-to-secure-your-kali-linux-machine.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
