---
description: Configuraciones en distribución Ubuntu.
---

# Configuraciones de sistema

***

## Crear y definir usuario con privilegios sudo y conectarse

```shell
adduser <user_name>
usermod -aG sudo <user_name>
su <user_name>
```

***

## Actualizar sistema e instalar paquetes básicos

```shell
sudo apt update && sudo apt upgrade -y
sudo apt install ufw git tmux
```

***

## Modificar fichero /etc/ssh/sshd\_config para conexiones SSH

```shell
PermitRootLogin no
Port 22222
MaxAuthTries 3
MaxSessions 1
PubkeyAuthentication yes
PasswordAuthentication no
```

***

## Reestablecer servicio sshd

```shell
sudo systemctl restart ssh
sudo systemctl restart sshd
```

***

## Habilitar y configurar UFW

```shell
sudo ufw enable
sudo ufw default deny incoming
sudo ufw allow 443/tcp
sudo ufw allow 22222/tcp
sudo ufw status verbose
```

***

## Instalar repositorios de Kali Linux

* Editar fichero sources.list

```bash
sudo nano /etc/apt/sources.list
	deb http://http.kali.org/kali kali-rolling main non-free contrib 
	deb-src http://http.kali.org/kali kali-rolling main non-free contrib
```

* Agregar clave GPG de repositorios de Kali

```bash
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ED444FF07D8D0BF6
```

{% hint style="warning" %}
_Si se presenta error por claves GPG de Kali ejecutar lo siguiente_



* Descargar clave GPG de Kali

```bash
wget -q -O - https://archive.kali.org/archive-key.asc | sudo gpg --dearmor -o /etc/apt/keyrings/kali-archive-keyring.gpg
```

* Editar fichero sources.list

```shell
sudo nano /etc/apt/sources.list
	deb [signed-by=/etc/apt/keyrings/kali-archive-keyring.gpg] http://http.kali.org/kali kali-rolling main non-free contrib
	deb-src [signed-by=/etc/apt/keyrings/kali-archive-keyring.gpg] http://http.kali.org/kali kali-rolling main non-free contrib
```

* Asignar permisos 644 al fichero kali-archive-keyring.gpg de ser necesario

```bash
sudo chmod 644 /etc/apt/keyrings/kali-archive-keyring.gpg
```

* Actualizar repositorios y sistema

```bash
sudo apt update
```
{% endhint %}

***

## Solución a error por respuesta fallida de DNS

```shell
sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved
sudo rm /etc/resolv.conf
```

* Crear fichero resolv.conf y agregar direcciones IP de DNS

```bash
sudo nano /etc/resolv.conf
	nameserver 8.8.8.8
	nameserver 8.8.4.4
	nameserver 1.1.1.1
```

***
