Intro to Linux

TSYS School of Computer Science & Rothschild Leadership Academy 2017-2018 Acknowledgements

Middle School Cybersecurity Curriculum is prepared by the TSYS School of Computer Science in collaboration with Rothschild Leadership Academy in Columbus, GA. This project is funded by a 2017 -2018 NSA MEPP Grant.

Contributors: Dr. Yesem Kurt Peker, Assistant Professor of CS Columbus State University Hillary Fleenor, Instructor and Outreach Coordinator at Columbus State University Ebone Cutts, Business Teacher at Rothschild Leadership Academy Loran Shaver, Senior Student at Columbus State University Maidel Fletes, Sophomore Student at Columbus State University, Noyce Intern What Is Linux?

• Linux is an : It is a collection of software that manages hardware resources and provides an environment where applications can run. • It allows applications to store information, send documents to printers, interact with users, etc. History of Linux

• A Finnish student Linus Torvalds created Linux in 1991 at age 21, • Linux is an source software. • Since the initial release of its source code in 1991, Linux has grown from a small number of C files under a license prohibiting commercial distribution with than 16 million lines of source code under the GNU General Public License.

Photo by Martin Streicher / CC BY-SA 3.0 Linux System Architecture

Linux System Architecture consists of following layers: ● Hardware layer - Hardware consists of all peripheral devices (RAM/ HDD/ CPU etc). ● Kernel - Core component of Operating System, interacts directly with hardware, provides low level services to upper layer components. ● - An interface to kernel, hiding complexity of kernel's functions from users. ● Utilities - Utility programs giving user most of the functionalities of an operating systems. Linux Structure

• The Filesystem Hierarchy Standard (FHS) defines the structure of file systems on Linux and other UNIX-like operating systems. Some Main Directories

/ (the root directory) Everything on your Linux system is located here /bin the place for most commonly used terminal commands, like ls, , rm, mount, etc. /etc contains system-global configuration files, affect the system's behavior for all users. /home the place for users' home directories. /var/log stores log files for various system programs

Two special directories included in every directory: ● Parent directory .. ● Current directory . Linux Core Commands Command Task pwd ls [location] List the files in the given location (in the working directory ls –l if location is missing) ls -a cd [location] Change to the directory given in location cd .. Go up one directory (to the parent directory)

[name] Make (create) a directory with given name

touch [] Create an empty file with given filename

rm [filename] Removes the file rm –rf [directoryname] Removes the directory and all its content including subfolders Linux Core Commands - Continued Command Task cat [filename] View content of file with given filename cat >[filename] Create a new file called filename ( if already exists) with content that will be typed until Ctrl+C is hit cat >>[filename] Add to the end of file filename (create one if it doesn’t exist) the content that will be typed until Ctrl+C is hit nano [filename] Create/modify a file using the nano editor id Display user information (user id and name, group id and name, id and name of supplementary groups, cp [filename] [filename or ] the file to the new filename or the location given by path mv [filename] [filename or path] the file to the new filename or the location given by path Absolute Path

• Absolute path is the shortest path to a file starting with the root directory. • Consider the directories given in the picture shown on the right. • The absolute path to file1 is: /home/seed/principles/test1/test3/file1 Relative Path

• Relative path is the shortest path to a file starting with the current (working) directory. • Consider the directories given in the picture on previous slide and suppose the user is in test1 directory.

Relative path to file1 from test1 is test3/file1

Relative path to file3 from test1 is ../test2/test4/file3 Example: Absolute vs Relative Path

• Suppose I am logged in as the sysadmin and am in the test3 directory. • I’d like to cd into the test4 directory under test2.

• I can use: A relative path: cd ../../test2/test4 OR The absolute path: cd /home/sysadmin/test2/test4 Passwords in Linux

● Passwords are NOT stored in plaintext. ● If they were, then if an attacker stole the password file, then he/she would have all the passwords. ● Instead the hashes of the passwords are stored. ● Even better, the passwords are “salted” before hashing and the salt value and the resulting hash value are stored. ● Password salts and hash values are stored in shadow file in Linux (/etc/shadow) Typical entry in shadow file

A typical entry in the /etc/shadow file: yesem:$6$5H0QpwprRiJQR19Y$bXGOh7dIfOWpUb/Tuqr7yQVCqL3UkrJns9.7msfvMg4ZO/PsFC5Tbt 32PXAw9qRFEBs1254aLimFeNM8YsYOv.:16431:0:99999:7::: yesem username $6$ SHA512 (Secure Hash Algorithm with 512 bits) 5H0QpwprRiJQR19Y Salt value 16431 last password change in number of days since Jan 1 1970 0 minimum days between password changes 99999 Password validity (days) 7 Warning threshold Account inactive Time since account disabled Resources

• https://www.digitalocean.com/community/tutorials/brief-history-of-linux • http://futurist.se/gldt/wp-content/uploads/11.04/gldt1104.png • https://www.howtogeek.com/117435/htg-explains-the-linux-directory-structure-explained/ • https://www-uxsup.csx.cam.ac.uk/pub/doc/suse/suse9.0/userguide-9.0/ch24s04.html • https://www.linux.com/blog/absolute-path-vs-relative-path-linuxunix