Kali Linux Commands - Part 3 What to do after installing kali linux

Destroying Kali Linux 

sudo rm -rf / --n-preserve-root

sudo apt autoremove

Install terminal multiples

sudo apt install tilix, konsole , guake

Installing htop, iftop 

iftop - Shows bandwith usage

htop - Shows cpu/resources usage

Set up root user

sudo usermod -aG sudo username

Add user to sudo users

sudo visudo

yourusername

ALL=(ALL:ALL)ALL

Kali Linux Network Configuration

sudo nano /etc/network/interfaces

SSH

sudo systemctl enable ssh

Configuring firewall

sudo ufw status

sudo apt install ufw

sudo ufw enable

Virtual Box Guest Additions

lsmod | grep vboxguest - checks that it installed or not.

if not then update and

then $sudo apt install -y virtualbox-guest-x11

lsmod | grep vboxguest 


TimeZone

timedatectl

$sudo timedatectl set-timezone America/New_York

to change the time zone


Install Graphics Drivers

lspci -v | grep -A 12 VGA


Secure GRUB bootloader

cat /etc/default/grub/

Restrict access grub command line files

GRUB_DISABLE_RECOVERY="true" - uncomment this from bottom of this file cat /etc/default/grub/

.

Remove unnecessary Services
sudo service --status-all
sudo service bluetooth start
sudo systemctl disable bluetooth

Encrypt Hard Drive
lsblk
sudo apt install cryptsetup
sudo cryptsetup -y luksFormat /dev/sdx

Configuring Automatic Updates
$sudo apt update
$sudo apt install unattended-upgrades
$sudo nano /etc/apt/apt.conf.d/10periodic - allows various parameters to updates.
then add to your text editor APT::Periodic::Update-Packages-Lists "1";

Enabling AppArmor or SELinux
AppArmor in Kali Linux is a security system that helps protect your system and applications from malicious activity.
App-Armor Installation
sudo aa-status
sudo apt install apparmor
sudo service apparomor start
sudo systemctl start apparmor

SELinux Installation
sudo apt install selinux-basics selinux-policy-default

Installing Tor
$sudo apt install tor
$sudo service start tor
$sudo systemctl start tor
$sudo systemctl status tor

Bash shell customization
nano ~/.bashrc
PS1="add color here in ps1 variable"

Absolutely! Here are some color codes you can use to add some flair to your PS1 variable:

Basic Colors:

  • Foreground:
    • Black: \[\033[30m\]
    • Red: \[\033[31m\]
    • Green: \[\033[32m\]
    • Yellow: \[\033[33m\]
    • Blue: \[\033[34m\]
    • Magenta: \[\033[35m\]
    • Cyan: \[\033[36m\]
    • White: \[\033[37m\]
  • Background:
    • Black: \[\033[40m\]
    • Red: \[\033[41m\]
    • Green: \[\033[42m\]
    • Yellow: \[\033[43m\]
    • Blue: \[\033[44m\]
    • Magenta: \[\033[45m\]
    • Cyan: \[\033[46m\]
    • White: \[\033[47m\]

Bold and Underline:

  • Bold: \[\033[1m\]
  • Underline: \[\033[4m\] (Not widely supported by all terminals)

Reset:

  • Reset all formatting: \[\033[0m\]

Example PS1 with Colors:

Here's an example PS1 variable that uses some of these codes:

PS1="\[\033[32m\]\u@\h\[\033[33m\]:\w\[\033[36m\] $(git branch 2> /dev/null | grep '^* .' | col  cut -d ' ' -f2-)\[\033[0m\]\$ "

This example shows:

  • Username in Green
  • Hostname in Yellow
  • Working directory in Cyan
  • Current Git branch in Magenta (if any)
  • Prompt symbol ($) in White

Using tput for better compatibility:

An alternative way to achieve colors is using the tput command. This ensures wider compatibility across different terminals. Here's an example:

PS1="\[$(tput bold)\]\u@\h:\[$(tput setaf 33)\]\w\[$(tput setaf 36)\] $(git branch 2> /dev/null | grep '^* .' | col  cut -d ' ' -f2-)\[$(tput sgr0)\]\$ "

This achieves the same color scheme as the previous example but uses tput commands.

Remember to enclose the color codes within \[ and \] brackets within your PS1 variable. Explore different color combinations to personalize your prompt!

Desktop & File Setting

Single click to open files

Add to panel

Set root user password

sudo passwd root

Check Default Repository

vim /etc/apt/sources.list/

Install Java

sudo apt install default-jdk

sudo apt-cache search openjdk

Install archieve manager

apt-get install unrar unace rar unrar p7zip zip unzip p7zip-full p7zip-rar file-roller -y

Add Standard User: 

useradd -m user1 

sudo passwd user1 

sudo usermod -a -G user1 

Sudo chsh -s /bin/bash user1 

Install Tor: 

sudo apt install tor 

sudo service tor start 

Install VLC: 

sudo apt install vlc 

Install GDebi Package Manager: 

GDebi Package Manager is a simple tool for installing and managing Debian (.deb) packages on Debian-based Linux distributions, including Kali Linux. It provides a graphical user interface (GUI) that makes it easy to install and view information about Debian packages.

sudo gdebi package_file.deb

and

sudo dpkg -i .deb both do same thing

Yes, both sudo gdebi package_file.deb and sudo dpkg -i package_file.deb are used to install Debian (.deb) packages on Debian-based Linux distributions like Kali Linux.

sudo apt-get install gdebi -y

Proxychains all commands <query>

sudo nano /etc/proxychains4.conf


Keyboard Configuration

Keyboard Layout

sudo dpkg-reconfigure keyboard-configuration

Virtual Box Snapshots

checkout ceos3c for articles

Guake terminal

$sudo apt install guake

$sudo apt disk-upgrade

$sudo cp /usr/share/applications/guake.desktop/etc/xdg/autostart/

Fail2ban

Fail2Ban helps protect your system from brute-force attacks.

sh

sudo apt install fail2ban

sudo nano /etc/fail2ban/jail.local

[sshd]

enabled = true

port = ssh

filter = sshd

logpath = /var/log/auth.log

maxretry = 5

sudo systemctl restart fail2ban

Setup automatic updates
sudo apt install unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades

Monitor logs 
Regularly monitor system logs for any suspicious activity.
sudo apt install logwatch
sudo nano /usr/share/logwatch/default.conf/logwatch.conf

7. Configure System Auditing

1.Use auditd for comprehensive system auditing.

$sudo apt install auditd audispd-plugins

$sudo systemctl enable auditd 

$sudo systemctl start auditd

2.sudo nano /etc/audit/audit.rules
3.-w /etc/passwd -p wa -k passwd_changes

4.Restart service - sudo systemctl restart auditd

Configure bash aliases

nano ~/.bash_aliases

Kali Linux metapackages


10. Use AppArmor or SELinux

Enhance security with mandatory access control frameworks.

Install AppArmor

sudo apt install apparmor apparmor-profiles apparmor-utils 
sudo systemctl enable apparmor 
sudo systemctl start apparmor

Install SELinux (optional and more complex

sudo apt install selinux-basics selinux-policy-default auditd
sudo selinux-activate
sudo reboot


11. Secure Shared Memory

Edit /etc/fstab to secure shared memory.

sudo nano /etc/fstab

Add the following line:

tmpfs /run/shm tmpfs defaults,noexec,nosuid 0 0


12. Configure Time Synchronization

Ensure your system clock is synchronized.

Install and Enable ntp or chrony

sudo apt install ntp
sudo systemctl enable ntp
sudo systemctl start ntp

Or, with chrony:

sudo apt install chrony
sudo systemctl enable chrony
sudo systemctl start chrony

13. Monitor System Resource Usage

Use tools like htop, iotop, and iftop to monitor system performance.

Install Monitoring Tools

sudo apt install htop iotop iftop

14.Shells

sudo apt install fish -y

sudo apt install -y zsh

sudo apt install -y bash 

sudo apt install chsh -y

sudo apt install -y bash-completion

27. Change the Window Manager:

Change the window manager using compiz, metacity, or kwin.

28. Customize the Window Decorations:

Customize window decorations using gtk-window-decorator or kwin settings.

29. Add Custom System Scripts:

Add custom system scripts using systemd or init.d configurations.

30. Customize the System Info:

Customize system information using neofetch or screenfetch configurations.

31. Create Persistence for Live USB

If you are using Kali Linux from a USB stick, create a persistent partition to save your settings and data.

a. Create a Persistent Partition

Use tools like GParted to create a new partition on the USB drive.

b. Configure Persistence

Boot into Kali Live and select the "Live USB Persistence" option. Follow the instructions to set up persistence.


20. Add Custom System Sounds:

Add custom system sounds using the sound settings or alsa configurations.

22. Customize the Network Manager:
Customize network manager settings using network-manager or wicd

16. Customize the File Manager:
Customize the file manager using nautilus, dolphin, or thunar settings..

Happy Hacking:)

#linuxcommands #linuxcustomization #terminalcustomization #kalilinux

Comments

Popular posts from this blog

Linux Commands part - 2