Linux Kung-Fu. James Droste UBNetDef Fall 2016

Similar documents
Linux Kung Fu. Stephen James UBNetDef, Spring 2017

Introduction. What is Linux? What is the difference between a client and a server?

Linux Kung Fu. Ross Ventresca UBNetDef, Fall 2017

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers

Linux Systems Administration Getting Started with Linux

Welcome to getting started with Ubuntu Server. This System Administrator Manual. guide to be simple to follow, with step by step instructions

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions

INTRODUCTION TO LINUX

Linux Essentials Objectives Topics:

The kernel is the low-level software that manages hardware, multitasks programs, etc.

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

Operating systems fundamentals - B10

Exercise Sheet 2. (Classifications of Operating Systems)

Outline. Structure of a UNIX command

Course 144 Supplementary Materials. UNIX Fundamentals

Operating Systems Lab 1 (Users, Groups, and Security)

Everything about Linux User- and Filemanagement

Introduction to Linux. Roman Cheplyaka

CST8207: GNU/Linux Operating Systems I Lab Seven Linux User and Group Management. Linux User and Group Management

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

CS/CIS 249 SP18 - Intro to Information Security

*nix Crash Course. Presented by: Virginia Tech Linux / Unix Users Group VTLUUG

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Introduction of Linux

Commands are in black

Lab Authentication, Authorization, and Accounting

Student Remote Login Procedure (see picture below): 1. Start SSH Secure Shell 2. Click the computer icon (4 th on the toolbar) 3.

Introduction to Linux

Perl and R Scripting for Biologists

Unix Filesystem. January 26 th, 2004 Class Meeting 2

A Brief Introduction to Unix

CSE 390a Lecture 3. Multi-user systems; remote login; editors; users/groups; permissions

Embedded System Design

commandname flags arguments

Introduction to Linux

Assume that username is cse. The user s home directory will be /home/cse. You may remember what the relative pathname for users home directory is: ~

National University of Computer and Emerging Sciences Operating System Lab - 02 Lab Manual

CST8207: GNU/Linux Operating Systems I Lab Seven Linux User and Group Management. Linux User and Group Management

Introduction to remote command line Linux. Research Computing Team University of Birmingham

CS4350 Unix Programming. Outline

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Introduction to Unix May 24, 2008

More Raspian. An editor Configuration files Shell scripts Shell variables System admin

Embedded Linux Systems. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

Course Wiki. Today s Topics. Web Resources. Amazon EC2. Linux. Apache PHP. Workflow and Tools. Extensible Networking Platform 1

Introduction to Linux

1. Open VirtualBox and start your linux VM. Boot the machine and log in with the user account you created in Lab #1. Open the Terminal application.

The landscape. File hierarchy overview. A tree structure of directories The directory tree is standardized. But varies slightly among distributions

Introduction to Linux

Introduction: What is Unix?

LAB #7 Linux Tutorial

Introduction to Linux (Part I) BUPT/QMUL 2018/03/14

Linux basics U3A in Bath. Linux Principles. by Andy Pepperdine

Getting Started with Linux

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Some Ubuntu Practice...

Outline. UNIX security ideas Users and groups File protection Setting temporary privileges. Examples. Permission bits Program language components

Filesystem Hierarchy Operating systems I800 Edmund Laugasson

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

GNU/Linux: An Essential Guide for Students Undertaking BLOSSOM

Essential Unix and Linux! Perl for Bioinformatics, ! F. Pineda

Users, Groups and Permission in Linux

Linux OS Fundamentals for the Windows Admin

Introduction to Unix Part II: Special Topics

commands exercises Linux System Administration and IP Services AfNOG 2015 Linux Commands # Notes

CST Lab 2 Review #1

Files and Directories

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT

Working with Ubuntu Linux. Track 2 Workshop June 2010 Pago Pago, American Samoa

Actual4Test. Actual4test - actual test exam dumps-pass for IT exams

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

UNIT 9 Introduction to Linux and Ubuntu

Topics. Installation Basics of Using GNU/ Linux Administration Tools

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29

Unix Workshop Aug 2014

Linux crash lecture by Andrey Lukyanenko

bash startup files Linux/Unix files stty Todd Kelley CST8207 Todd Kelley 1

CS246 Spring14 Programming Paradigm Notes on Linux

RH-202. RedHat. Redhat Certified Technician on Redhat Enterprise Linux 4 (Labs)

Filesystem Hierarchy and Permissions

Introduction to Linux

Introduction to Linux

Basic Linux Security. Roman Bohuk University of Virginia

Computer Systems and Architecture

The Wonderful World of Services VINCE

1 Installation (briefly)

client X11 Linux workstation

Unix. Examples: OS X and Ubuntu

Exam Linux-Praxis - 1 ( From )

Introduction to the UNIX command line

CST8207: GNU/Linux Operating Systems I Lab Six Linux File System Permissions. Linux File System Permissions (modes) - Part 1

Unix Basics. Benjamin S. Skrainka University College London. July 17, 2010

"Charting the Course... MOC B: Linux System Administration. Course Summary

CSCI 2132 Software Development. Lecture 4: Files and Directories

An Introduction to Linux

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

Exploring UNIX: Session 3

Course 55187B Linux System Administration

Chapter 8: Security under Linux

Transcription:

Linux Kung-Fu James Droste UBNetDef Fall 2016

$ init 1 GO TO https://apps.ubnetdef.org GO TO https://apps.ubnetdef.org GO TO https://apps.ubnetdef.org GO TO https://apps.ubnetdef.org GO TO https://apps.ubnetdef.org GO TO https://apps.ubnetdef.org GO TO https://apps.ubnetdef.org GO TO https://apps.ubnetdef.org GO TO https://apps.ubnetdef.org

$ get_server_info GO TO: https://apps.ubnetdef.org/ssh HOST: 10.0.0.2 PORT: 22 USER: (you have this) PASS: (you have this)

$ whoami

$ whoami James Droste Started using linux / the terminal at ~13 Prefers the debian linux distribution (hint: the server you re connected to is running this!) Kind-Of System Administrator Typical Linux Guy for the UBNetDef Competition Team 21 years in dank memes

$ echo $ajenda The Basics Files Directories - Oh My! Processes Pipes and Redirects Becoming god (root) Package Managers Services Best Practices Advanced Stuff

The Basics: Level 1

$ what_is_the_terminal

$ reading_your_prompt root@netdef:~# User: root Computer Name (hostname): netdef Current Directory: ~ ß????? Is Super User: Yes

$ what_is_the_terminal echo: Outputs (echo's) the data you pass into this function jamesdro@netdef:~$ echo Hello World Hello World passwd: Allows you to change your own (or another user s) password jamesdro@netdef:~$ passwd Changing password for jamesdro. (Current) UNIX password: root@netdef:~# passwd another-user Changing password for another-user. Enter new UNIX password:

$ getting_help $COMMAND --help: Typically shows the help documentation for a command. jamesdro@netdef:~$ passwd help Usage: passwd [options] [LOGIN] (snip) man $COMMAND: Shows the MANual for $COMMAND. jamesdro@netdef:~$ man passwd (Press Q to exit)

$ user_management adduser addgroup usermod groups su: Allows you to Switch User. jamesdro@netdef:~$ su root Password:

$ user_management root@net-def:~# adduser test Adding user `test'... Adding new group `test' (1006)... Adding new user `test' (1004) with group `test'... Creating home directory `/home/test'... Copying files from `/etc/skel'... (snip) root@net-def:~# addgroup another-test Adding group `another-test' (GID 1007)... Done. root@net-def:~# usermod -G another-test -a test root@net-def:~# groups test test : test another-test

Files, Oh My!

$ moving_around ls: LiSt the files in a directory jamesdro@netdef:~$ ls nuclear_launch_codes.txt secrets cd: Change Directory jamesdro@netdef:~$ cd secrets jamesdro@netdef:~/secrets$ pwd: Print Working Directory jamesdro@netdef:~/secrets$ pwd /home/jamesdro/secrets

$ moving_around_advanced ls al: Run the ls command, with the arguments -al. Argument a tells ls to print all files in the directory. l tells ls to do it the long way. jamesdro@netdef:~$ ls al total 1536 drwx------ 4 jamesdro jamesdro 4096 Oct 6 09:47. drwxr-xr-x 23 root root 4096 Aug 22 23:49.. -rw------- 1 jamesdro jamesdro 9244 Oct 6 01:48.bash_history -rw-r--r-- 1 jamesdro jamesdro 570 Jan 31 2010.bashrc drwx------ 3 jamesdro jamesdro 4096 Oct 5 14:50.cache -rw-r--r-- 1 jamesdro jamesdro 1524722 May 21 19:30 nuclear_launch_codes.txt -rw-r--r-- 1 jamesdro jamesdro 140 Nov 19 2007.profile -rw------- 1 jamesdro jamesdro 1024 Aug 28 00:15.rnd -rw-r--r-- 1 jamesdro jamesdro 66 Aug 28 01:51.selected_editor drwxr-xr-x 2 jamesdro jamesdro 4096 Oct 6 09:47 secrets

$ reading_is_important cat: concatenate a file (aka: print the file contents to the terminal) jamesdro@netdef:~$ cat nuclear_launch_codes.txt [Now I can t show you that ;-)] less/more: Viewers that let you interactively scroll through a file. jamesdro@netdef:~$ less nuclear_launch_codes.txt Let s view a file that contains all the user accounts on the system /etc/passwd WHO ARE THEY?

$ writing_is_cool_too nano vi vim ed emacs Magnetic needle

$ note_about_permissions Files/Folders have this thing called Access Control Lists (ACLs) This is a large topic on it self tl;dr: Linux matches based on the file s owner, file s group, then everyone else. Each permission set can have read, write, or execute privilege (any combination) These can be represented with octal notation (1=execute, 2=write, 4=read) Permissions can be changed with the command chmod Ownership can be changed with the command chown Group ownership can be changed with the command chown or chgrp

Processes, Pipes, Redirects

$ viewing_processes ps: Process Snapshot. Shows currently running processes. jamesdro@netdef:~$ ps jamesdro@netdef:~$ ps aux top/htop: Interactive way to show all the currently running processes jamesdro@netdef:~$ top jamesdro@netdef:~$ htop kill: Used when we want to MURDER kill a process. jamesdro@netdef:~$ kill <pid> jamesdro@netdef:~$ kill -9 <pid> or: jamesdro@netdef:~$ kill SIGKILL <pid>

$ pipes_and_redirects is the pipe operator > is the redirect operator Examples jamesdro@netdef:~$ ps aux less jamesdro@netdef:~$ ps aux > some_file.txt jamesdro@netdef:~$ who awk { print $1 } > users.txt

Here Be Dragons

$ woot_woot_got_root sudo: Super User DO. Runs a specific command as a super user (uid=0, aka root). jamesdro@netdef:~$ sudo whoami root jamesdro@netdef:~$ whoami jamesdro

$ packages aptitude: Debian, Ubuntu apt-get: Debian, Ubuntu dpkg: Debian, Ubuntu yum: CentOS dnf: Fedora

$ packages_2

$ packages_3 Installing a package jamesdro@netdef:~$ sudo apt-get install <package-name> Removing a package jamesdro@netdef:~$ sudo apt-get remove <package-name> Updating the local package index jamesdro@netdef:~$ sudo apt-get update Updating a package jamesdro@netdef:~$ sudo apt-get upgrade <package-name> Updating ALL packages jamesdro@netdef:~$ sudo apt-get upgrade

$ packages_4_this_never_ends Typical flow (installing package apache which is a web server) jamesdro@netdef:~$ sudo apt-get update jamesdro@netdef:~$ sudo apt-get install apache Daily Ritual jamesdro@netdef:~$ sudo apt-get update jamesdro@netdef:~$ sudo apt-get upgrade

$ services_1

$ services_2 systemctl: Part of this new subsystem that is called SystemD service: Part of System V init /etc/init.d/<service> <start stop restart status>: Part of System V init, deprecated

$ services_3_electric_boogaloo Starting a service - apache Using systemd: jamesdro@netdef:~$ sudo systemctl start apache Using sysvinit: jamesdro@netdef:~$ sudo service apache start Stopping a service - apache Using systemd: jamesdro@netdef:~$ sudo systemctl stop apache Using sysvinit : jamesdro@netdef:~$ sudo service apache stop

$ linux_directories_revealed /bin: Contains all binaries that are necessary for the system to function /boot: Contains the linux bootloader /dev: Contains all raw DEVices /etc: Contains configuration files for the system /home: Contains user s home directories /mnt: Typically used when mounting devices (like a cdrom) /opt: Optional, addon packages /proc: Here be dragons /root: User root s home directory /sbin: Contains all the binaries that are necessary for the system to run. Only super users can use these. /tmp: Temporary files /usr: User install files

$ good_files_to_know /etc/passwd /etc/shadow /etc/crontab (/etc/cron.{d,daily,weekly,hourly,monthly}/*}

$ init 0