Software I: Utilities and Internals

Slides:



Advertisements
Similar presentations
5 Basic utilities When a user logs in to the Linux operating system the directory that they will start in is their home directory. Most users will have.
Advertisements

Introduction to Unix (CA263) File System
Exploring the UNIX File System and File Security
Linux+ Guide to Linux Certification, Second Edition
Linux Linux File System.
Guide To UNIX Using Linux Third Edition
UNIX Files and Security Software Tools. Slide 2 File Systems l What is a file system? A means of organizing information on the computer. A file system.
File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.
Guide To UNIX Using Linux Fourth Edition
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
Manage Directories and Files in Linux
Files & Directories Objectives –to be able to describe and use the Unix file system model and concepts Contents –directory structure –file system concepts.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
File Permissions. What are the three categories of users that apply to file permissions? Owner (or user) Group All others (public, world, others)
Linux+ Guide to Linux Certification, Second Edition
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2011 by the Trustees of Indiana University except as noted.
The UNIX File System. The UNIX File A file is a container for storing information and data. Filename limited to 255 characters. Can’t contain / or NULL.
Chapter Two Exploring the UNIX File System and File Security.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
File Permission and Access. Module 6 File Permission and Access ♦ Introduction Linux is a multi-user system where users can assign different access permission.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
UNIX File System by Tero Toikkanen, CAP02S. UNIX Multi-user system Multi-user system Multi-tasking system Multi-tasking system Wide selection of tools.
Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:
Manage Directories and Files in Linux. 2 Objectives Understand the Filesystem Hierarchy Standard (FHS) Identify File Types in the Linux System Change.
Chapter Two Exploring the UNIX File System and File Security.
ITR3 lecture 6: intoduction to UNIX Thomas Krichel
Chapter 4: File Security & Permissions Also: Hard and Soft Links, see p77-80 &
Chapter 4 The File Structure. Contents u The Hierarchical File Structure u Directory and Ordinary Files u Directories u Access Permissions u Links.
E X C E E D I N G E X P E C T A T I O N S Basic LINUX Linux System Administration Dr. Hoganson Kennesaw State University Operating Systems Directory structure:
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem.
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2007 by the Trustees of Indiana University except as noted.
Linux Commands C151 Multi-User Operating Systems.
Slide: 1 UNIX FILE SYSTEM By:Qing Yang ID: Operating System Research Topic December, 2000.
Linux Filesystem WeeSan Lee. Roadmap Disk Partitions The Filesystem Filesystem Mouting & Umounting File Tree File Type File Permission.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Interface.
The Unix File system (UFS) Presented by: Gurpreet Singh Assistant Professor Department of School of Computing and Engineering Galgotias University.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
THE FILE SYSTEM Files long-term storage RAM short-term storage Programs, data, and text are all stored in files, which is stored on.
CIT 383: Administrative ScriptingSlide #1 CIT 383: Administrative Scripting Directories.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
File System Security ls -l. First Columm d = directory l = symbolic link b = block special file c = character special file p = fifo (or named pipe) special.
The Unix File System R Bigelow. The UNIX File System The file system refers to the way in which UNIX implements files and directories. The UNIX file system.
LINUX Zhengli Zhu, School of Life Sciences. Outline 1. ABC of Linux 2. Basic orers of Linux 3. Bash Programming.
ORAFACT The Linux File System. ORAFACT Filesystem Support Support for dozens of filesystem types including: Minix, ext2, MS-DOS, UMSDOS, VFAT, NTFS, NFS,
Linux Administration – Finding You Way on the Command Line The Linux File Directory or Tree.
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II FILES AND FILE SYSTEM STRUCTURE.
Linux Filesystem Management
Introduction to Unix – CS 21
Agenda The Linux File System (chapter 4 in text)
Linux 101 Training Module Linux Basics.
Linux file system "On a UNIX system, everything is a file;
Lecture 2 Working with Files and Directories
C151 Multi-User Operating Systems
BIF703 File Permissions.
Exploring the UNIX File System and File Security
CIT 383: Administrative Scripting
Chapter 7 File and file System structure
Security and File Permission
UNIX Commands A Brief Look at Common UNIX Commands.
UNIX Commands A Brief Look at Common UNIX Commands.
Perl Scripting and The File system
UNIX Commands A Brief Look at Common UNIX Commands.
UNIX Commands A Brief Look at Common UNIX Commands.
Chapter 4: The Linux Filesystem
In the last class, The concept of file system
January 26th, 2004 Class Meeting 2
Presentation transcript:

Software I: Utilities and Internals Lecture 3 – File System Commands – Day 2 * Modified from Dr. Robert Siegfried original presentation

Write a binary file to see in OD echo -n $'\x3b' > binout3.bin See with od -c as a ; See with od -d as 59; See with od -x as 3b;

Making an executable Script Just set the proper level executable permission chmod +x file Run the command file from the local dir ./mycommand

chmod – Change (Permission) Mode chmod –x junk takes away everyone’s execute permission chmod +r junk gives everyone’s read permission chmod u+rgo-w junk gives owner (or user) read permission takes away group and other’s everyone’s write permission

More on chmod permission u user or owner g group o other r read permission w write permission x execute permission + add a permission - takes away a permission

chmod Permission Codes We can set all of these at once using chmod 754 junk Owner gets all permissions Others gets read Permission only Group gets read and execute permission 4 read 2 write 1 execute

chmod Permission Codes 7 read, write, execute 6 read, write 5 read, execute 4 read only 3 write and execute 2 write only 1 execute only 0 no permission What will these do? chmod 725 junk chmod 640 junk chmod 632 junk chmod 751 junk Rewrite these in ugo ±rwx format

chown and chgrp chown changes the owner of the file as well as the group(if the option is chosen. Only the superuser (root) can do this in Linux. chgrp can change group to which the file belongs. PEPPER@panther:~/270$ groups users csc440Spring14 PEPPER@panther:~/270$ chgrp csc440Spring14 vitest1 PEPPER@panther:~/270$ ls -l vitest1 -rw-r--r-- 1 PEPPER csc440Spring14 15 Sep 1 00:40 vitest1

User Masks When UNIX creates a new file, it assumes the mode (permission scheme) is: 666 (for non-executable ordinary files) 777 (for executable files and directories) From this, it subtracts the user mask. To set the user mask, use the umask command. The format is umask binaryMask Contains the permissions that you are turning off.

umask – Some Examples umask 122 – turns read off for owner, turns write off for group and others. umask 023 – turns write off for group and write and execute off for others. umask 065 – turns read and write off for group and read and execute off for others. Typing umask without a parameter will result in getting the mask displayed.

Simplified File System Structure http://www.porcupine.org/forensics/forensic-discovery/chapter3.html

Inodes Inode is short for information node. See with stat filename Inodes contain most of the important information about a file including: length of the file (in bytes). device id (identifying the device in which the file is located). user id of the file's owner. group of the file (usually that of the file's owner) file mode (the type of the file – regular, directory, link, device, and the permission codes. times and dates of last modification and access link count - the number of (hard) links pointing to the inode. pointers to the disk blocks containing the file's contents.

Files and Inodes The only connection between the file name and file's contents is the inode. Links are established by having the inode number and the name appearing in the same directory listing. ln file newname establishes newname as an alternate way of accessing file.

ln Example SIEGFRIE@panther:~/recipes$ ln cookie oreo SIEGFRIE@panther:~/recipes$ ls -l total 12 -rw-r--r-- 2 SIEGFRIE users 81 Oct 6 12:12 cookie -rw-r--r-- 2 SIEGFRIE users 81 Oct 6 12:12 oreo -rw-r--r-- 1 SIEGFRIE users 63 Oct 6 12:13 pie

How the Basic File Commands Work cp UNIX creates a brand new file with its own inode number. mv The filename changes, it remains in its current directory and has its entry moved to the new directory, but inode number remains the same. ln A new directory entry is created with the existing file's inode number. rm or rmdir The directory entry is deleted. If there are no other links, the inode is deleted, too.

The Directory Hierarchy UNIX (and Linux) uses a hierarchical (tree- structure) directory system, the top level being /. SIEGFRIE@panther:~$ ls / bin dev initrd media opt sbin sys tmp usr boot etc lib misc proc selinux test u01 var delete_this home lost+found mnt root srv tftpboot users [SIEGFRIE@panther:~$

[SIEGFRIE@panther:~$ ls -l /dev total 0 crw------- 1 root root 36, 8 Apr 8 16:23 arpd lrwxrwxrwx 1 root root 3 Apr 8 20:24 cdrom -> hda crw------- 1 root root 5, 1 Apr 9 04:04 console ... ... brw-r----- 1 root root 253, 8 Apr 8 16:24 dm-8 crw------- 1 root root 36, 14 Apr 8 16:23 dnrtmsg crw------- 1 root root 13, 64 Apr 8 16:23 event0 brw-rw---- 1 root floppy 2, 44 Apr 8 20:24 fd0u1680 brw-rw---- 1 root floppy 2, 60 Apr 8 20:24 fd0u1722 lrwxrwxrwx 1 root root 15 Apr 8 20:24 stderr -> /proc/self/fd/2 lrwxrwxrwx 1 root root 15 Apr 8 20:24 stdin -> /proc/self/fd/0 lrwxrwxrwx 1 root root 15 Apr 8 20:24 stdout -> /proc/self/fd/1 lrwxrwxrwx 1 root root 4 Apr 8 20:24 systty -> tty0 crw-rw---- 1 root tty 4, 10 Apr 8 16:23 tty10 crw-rw---- 1 root tty 4, 11 Apr 8 16:23 tty11 crw-rw---- 1 root tty 4, 12 Apr 8 16:23 tty12

Major and Minor Device Codes Each directory listing for a device contains two numbers: Major device code – indicates the type of device. Minor device code – indicates which device of that type. http://www.makelinux.net/ldd3/chp-3-sect-2

Some Useful Things SIEGFRIE@panther:~$ who am i SIEGFRIE pts/4 Oct 6 13:23 (pool-… … .verizon.net) SIEGFRIE@panther:~$ tty /dev/pts/4 SIEGFRIE@panther:~$ ls -l /dev/pts/4 crw--w---- 1 SIEGFRIE tty 136, 4 Oct 6 13:47 /dev/pts/4 SIEGFRIE@panther:~$ date > /dev/pts/4 Tue Oct 6 13:48:03 EDT 2009 SIEGFRIE@panther:~$ mesg n crw------- 1 SIEGFRIE tty 136, 4 Oct 6 13:48 /dev/pts/4 SIEGFRIE@panther ~$ mesg y crw--w---- 1 SIEGFRIE tty 136, 4 Oct 6 13:48 /dev/pts/4 SIEGFRIE@panther:~$ Many programs uses this when stdin and stdout are redirected.