Slides null puliya linux basics

A presentation at Null Meet Bangalore Chapter in February 2016 in Bengaluru, Karnataka, India by Anant Shrivastava

Slide 1

Slide 1

LINUX PULIYA

Slide 2

Slide 2

ANANT SHRIVASTAVA Information Security Consultant Admin - Dev - Security null + OWASP + G4H http://anantshri.info and @anantshri Trainer : Blackhat, RuxCon, NullCon, g0s, c0c0n Speaker : Nullcon, c0c0n, ClubHack, RootConf Android Tamer Code Vigilant

Slide 3

Slide 3

WHAT ARE WE COVERING 1. Understanding *nix 2. File System Basics 3. Understanding I/O 4. Basic Commands 5. How to Exit VIM 6. Shell Script basics 7. Automation

Slide 4

Slide 4

NIX 1. Family of OS ranging from Unix, Linux, *BSD (FreeBSD, OpenBSD etc) 2. Follow same standards in terms of file systems, directory layout etc

Slide 5

Slide 5

LINUX 1. Free as in free speech not free beer 2. Everyone can create there own Distro 3. Hanna Montanna Linux and more

Slide 6

Slide 6

LINUX DISTRIBUTIONS 1. Various Linux Distributions 2. Debian Based (apt-get / dpkg) 3. RedHat based (yum / rpm) 4. LTS or not

Slide 7

Slide 7

FILE SYSTEM BASICS 1. Everything is a file 2. File System Layout 3. Standard File system layout 1. / as highest level 2. /etc for all configuration 3. /home : users home folder

Slide 8

Slide 8

Slide 9

Slide 9

FILE SYSTEM TYPES ext2 Maximum file size = 16 GB to 2 TB File system size = 2 TB to 32 TB ext3 1. Journaling (Linux Kernel 2.4.15) 2. Maximum file size = 16 GB to 2 TB 3. File system size = 2 TB to 32 TB ext4 1. Starting from Linux Kernel 2.6.19 ext4 2. Maximum file size = 16 GB to 16 TB 3. File system size = 1 EB 1. 1 EB = 1024 PB 2. 1 PB = 1024 TB

Slide 10

Slide 10

MORE FILE SYSTEM BASIC 1. File System Permissions -rwxrwxrwx 2. Suid bits -rwsrwxrwx 3. sgid bit -rwxrwsrwx 4. sticky bit -rwxrwxrwt 5. First bit can be l,c,b,d,-

Slide 11

Slide 11

SUDO 1. id 0 is omnipotent 2. its suggested not to use root access 3. So how do we do high privilege actions

Slide 12

Slide 12

STANDARD I/O 1. Input (<) 2. Output (>) 3. Error (2>)

Slide 13

Slide 13

USEFUL COMMANDS 1. ls, cd, mkdir 2. cut 3. grep 4. sed 5. sort 6. uniq 7. xargs 8. find 9. tr 10. ps 11. screen 12. netstat -lntp 13. file

Slide 14

Slide 14

EDITOR 1. Vim 2. Nano 3. EMACS

Slide 15

Slide 15

INSTALLING SOFTWARES 1. Debian apt-get install 2. Redhat yum install 3. python pip install 4. ruby gem install 5. npm / nodejs npm install

Slide 16

Slide 16

MORE USEFUL COMMANDS 1. python -m SimpleHTTPServer Port 2. !! 3. cd ~ 4. cd 5. mtr 6. mount and format 7. setting environment Variables

Slide 17

Slide 17

CRONTAB 1. Automate periodic execution * * * * * * CMD |||||| | | | | | +— Year (range: 1900-3000) | | | | +—— Day of the Week (range: 1-7, 1 standing for Monday) | | | +——— Month of the Year (range: 1-12) | | +———— Day of the Month (range: 1-31) | +————— Hour (range: 0-23) +—————— Minute (range: 0-59)

Slide 18

Slide 18

CONFIGURING SERVICES SSH Configuration file : /etc/ssh/sshd_config

Slide 19

Slide 19

USING SSH 1. SSH Authentication 1. Password 2. SSH Key 2. How to Configure SSH Login via Key 3. ~/.ssh/authorized_keys

Slide 20

Slide 20

SHELL SCRIPT BASICS 1. Shebang 2. $1 $2, $* $@ $0 3. read 4. echo 5. cat 6. Conditions 7. Loop 8. Expansion {}

Slide 21

Slide 21

WRITING CUSTOM SCRIPTS 1. Write a shell script to calculate simple interest 2. Write a shell script to check whether no is even or odd 3. Print prime numbers from 1 to 5000

Slide 22

Slide 22

OVERLOAD COMMANDS 1. alias 2. Why alias and why not 3. find location add path before everything else and then overload

Slide 23

Slide 23

EXAMPLE

Slide 24

Slide 24

QUESTIONS

Slide 25

Slide 25

THANK YOU