CSE II-Sem)

Size: px
Start display at page:

Download "CSE II-Sem)"

Transcription

1 a) Write a shell script that displays a list of all the files in the current directory to which the user has read, write and execute permissions. b) Develop an interactive script that asks for a word and a file name and then tells how many times that word occurred in the file. c) Write a shell script to perform the following string operations: i. To extract a sub-string from a given string. ii. To find the length of a given string. a) Write a shell script that displays a list of all the files in the current directory to which the user has read, write and execute permissions. Program: [CSESTAFF@localhost ex9]$ vi perm.sh echo "The list of File Names in the curent directory." echo "Which have Read,Write and Execute permisions. " for file in * do if [ -f $file ] then if [ -r $file -a -w $file -a -x $file ] then ls -l $file fi fi done Output: [CSESTAFF@localhost ex9]$ ls -l -rw-rw-r--. 1 CSESTAFF CSESTAFF 16 Jan 31 20:03 t1.txt [CSESTAFF@localhost ex9]$ chmod 777 t1.txt [CSESTAFF@localhost ex9]$ ls -l -rwxrwxrwx. 1 CSESTAFF CSESTAFF 16 Jan 31 20:03 t1.txt [CSESTAFF@localhost ex9]$ sh perm.sh The list of File Names in the curent directory. Which have Read,Write and Execute permisions. -rwxrwxrwx. 1 CSESTAFF CSESTAFF 16 Jan 31 20:03 t1.txt Page 1 of 9

2 b) Develop an interactive script that asks for a word and a file name and then tells how many times that word occurred in the file. Program: [CSESTAFF@localhost ex9]$ cat f1.txt day by day week by end week by week month by end month by month year by end but friendship is never end [CSESTAFF@localhost ex9]$ vi wcount.sh echo " Enter the word to be searched" read word echo "Enter the filename to be used" read flname echo "the no. of times the word ['$word'] occured in the file." grep -o $word $flname wc -l echo " the no of line that contains ['$word'] is" grep -c $word $flname Output: [CSESTAFF@localhost ex9]$ sh wcount.sh Enter the word to be searched by Enter the filename to be used f1.txt the no. of times the word ['by'] occured in the file. 6 the no of line that contains ['by'] is 3 Page 2 of 9

3 c) Write a shell script to perform the following string operations: a. To extract a sub-string from a given string. b. To find the length of a given string. Program: [CSESTAFF@localhost ex9]$ vi substr.sh echo "enter the string" read str strlen=${#str} echo "The length of the given string '$str' is:$strlen " echo "enter the string possibion in main str" read s1 echo "ending possition" read f1 echo $str cut -c$s1-$f1 [CSESTAFF@localhost ex9]$ Output: [CSESTAFF@localhost ex9]$ sh substr.sh enter the string krishnasai The length of the given string 'krishnasai' is:10 enter the string possibion in main str 8 ending possition 10 sai [CSESTAFF@localhost ex9]$ Page 3 of 9

4 File ownership is an important component of UNIX that provides a secure method for storing files. Every file in UNIX has the following attributes: Users A UNIX system serves many users. Users are an abstraction that denotes a logical entity for assignment of ownership and operation privileges over the system. A user may correspond to a real-world person, but also a type of system operation. So, in my system, I have user 'nick' that corresponds to me, but I also have user 'www' which corresponds to the privileges necessary to operate the local webserver. UNIX doesn't care about what the user means for me. It just knows what belongs to any given user and what each user is allowed to do with any given thing (file, program, device, etc) on the system. UNIX identifies each user by a User ID (UID) and the username (or login) such as 'nick' and 'www' is just an alias to the UID that makes humans more comfortable. Groups Users can be organized in groups. A user may belong to one or more groups of users. The concept of groups serves the purpose of assigning sets of privileges for a given resource and sharing them among many users that need to have them. (perhaps because they a re all members of a project working team and they all need access to some common project files) So, on my system user 'nick' and user 'www' both belong to the group 'perlfect'. This way, they can have some shared privileges over the files for this site. User 'nick' needs them to edit the site, and user 'www' needs them to manage the webserver that will be publishing the site. Ownership Every file in UNIX has an owner user and an owner group. So, for any file in the system, user 'nick' may have one of the following ownership relations: nick owns the file, i.e. the file's owner is 'nick'. nick is a member of the group that owns the file, i.e. the file's owner group is 'perlfect'. nick is neither the owner, nor belonging to the group that owns the file Permissions Every file on the system has associated with it a set of permissions. Permissions tell UNIX what can be done with that file and by whom. There are three things you can (or can't) do with a given file: read it, write (modify) it and Page 4 of 9

5 execute it. Unix permissions specify which of the above operations can be performed for any ownership relation with respect to the file. In simpler terms, what can the owner do, what can the owner group do, and what can everybody else do with the file. For any given ownership relation, we need three bits to specify access permissions: the first to denote read (r) access, the second to denote (w) access and the third to denote execute (x) access. We have three ownership relations: 'owner', 'group' and 'all' so we need a triplet for each, resulting in nine bits. Each bit can be set orclear. (not set) We mark a set bit by it's corresponding operation letter (r, w or x) and a clear bit by a dash (-) and put them all on a row. An example might be rwxr-xr-x.what this means is that the owner can do anything with the file, but group owners and the rest of the world can only read or execute it. Usually in UNIX there is also another bit that precedes this 9-bit pattern. You do not need to know about it, at least for the time being. So if you try ls -l on the command prompt you will get something like the following: [nick@thekla src]$ ls -l -rwxr-xr-x 1 nick users 382 Jan 19 11:49 bscoped.pl drwxr-xr-x 3 nick users 1024 Jan 19 11:19 lib/ -rwxr-xr-x 1 nick users 1874 Jan 19 10:23 socktest.pl The first column here shows the permission bit pattern for each file. The third column shows the owner, and the fourth column shows the owner group. By the time, the information provided by ls -l should be enough for you to figure out what each user of the system can do with any of the files in the directory. Directories Another interesting thing to note is that lib/ which is a directory has permissions, too. Permissions take a different meaning for directories. Here's what they mean: read determines if a user can view the directory's contents, i.e. do ls in it. write determines if a user can create new files or delete file in the directory. (Note here that this essentially means that a user with write access toa directory can delete files in the directory even if he/she doesn't have write permissions for the file! So be careful with this.) execute determines if the user can cd into the directory. Page 5 of 9

6 chmod To set/modify a file's permissions you need to use the chmod program. Of course, only the owner of a file may use chmod to alter a file's permissions. chmod has the following syntax: chmod [options] mode file(s) The 'mode' part specifies the new permissions for the file(s) that follow as arguments. A mode specifies which user's permissions should be changed, and afterwards which access types should be changed. Let's say for example: chmod a-x socktest.pl This means that the execute bit should be cleared (-) for all users. (owner, group and the rest of the world) The permissions start with a letter specifying what users should be affected by the change, this might be any of the following: u the owner user g the owner group o others (neither u, nor g) a all users This is followed by a change instruction which consists of a +(set bit) or -(clear bit) and the letter corresponding to the bit that should be changed. Let's see some examples: $ ls -l socktest.pl -rwxr-xr-x 1 nick users 1874 Jan 19 10:23 socktest.pl* $ chmod a-x socktest.pl $ ls -l socktest.pl -rw-r--r-- 1 nick users 1874 Jan 19 10:23 socktest.pl $ chmod g+w socktest.pl $ ls -l socktest.pl -rw-rw-r-- 1 nick users 1874 Jan 19 10:23 socktest.pl $ chmod ug+x socktest.pl $ ls -l socktest.pl -rwxrwxr-- 1 nick users 1874 Jan 19 10:23 socktest.pl* Page 6 of 9

7 $ chmod ug-wx socktest.pl $ ls -l socktest.pl -r--r--r-- 1 nick users 1874 Jan 19 10:23 socktest.pl Strange numbers... You might have encountered things like chmod 755 somefile and of course you will be wondering what this is. The thing is, that you can change the entire permission pattern of a file in one go using one number like the one in this example. Every mode has a corresponding code number, and as we shall see there is a very simple way to figure out what number corresponds to any mode. Every one of the three digits on the mode number corresponds to one of the three permission triplets. (u, g and o) Every permission bit in a triplet corresponds to a value: 4 for r, 2 for w, 1 for x. If the permission bit you add this value to the number of the permission triplet. If it is cleared, then you add nothing. (Some of you might notice that in fact, the number for a triplet is the octal value corresponding to the three-bit pattern - if you don't know what an octal value is, it doesn't really matter, just follow the intstructions) So if a file has rwxr-xrx permissions we do the following calculation: Triplet for u: rwx => = 7 Triplet for g: r-x => = 5 Tripler for o: r-x => = 5 Which makes : 755 So, 755 is a terse way to say 'I don't mind if other people read or run this file, but only I should be able to modify it' and 777 means 'everyone has full access to this file' chmod is used to change the permissions of files or directories. In general, chmod commands take the form: chmod options permissions filename If no options are specified, chmod modifies the permissions of the file specified byfilename to the permissions specified by permissions. permissions defines the permissions for the owner of the file (the "user"), members of the group who owns the file (the "group"), and anyone else ("others"). There are two ways to represent these permissions: with symbols ( alphanumeric characters), or withoctal numbers (the digits 0 through 7). Let's say you are the owner of a file named myfile, and you want to set its permissions so that: Page 7 of 9

8 1. the user can read, write, and execute it; 2. members of your group can read and execute it; and 3. others may only read it. This command will do the trick: chmod u=rwx,g=rx,o=r myfile This is an example of using symbolic permissions notation. The letters u, g, and o stand for "user", "group", and "other". The equals sign ("=") means "set the permissions exactly like this," and the letters "r", "w", and "x" stand for "read", "write", and "execute", respectively. The commas separate the different classes of permissions, and there are no spaces in between them. Here is the equivalent command using octal permissions notation: chmod 754 myfile Here the digits 7, 5, and 4 each individually represent the permissions for the user, group, and others, in that order. Each digit is a combination of the numbers 4, 2, 1, and0: 4 stands for "read", 2 stands for "write", 1 stands for "execute", and 0 stands for "no permission." So 7 is the combination of permissions (read, write, and execute), 5 is 4+0+1(read, no write, and execute), and 4 is (read, no write, and no execute). Following are the symbolic representation of three different roles: u is for user, g is for group, and o is for others. Following are the symbolic representation of three different permissions: r is for read permission, w is for write permission, x is for execute permission. Following are few examples on how to use the symbolic representation on chmod. 1. Add single permission to a file/directory Changing permission to a single set. + symbol means adding permission. For example, do the following to give execute permission for the user irrespective of anything else: $ chmod u+x filename Page 8 of 9

9 2. Add multiple permission to a file/directory Use comma to separate the multiple permission sets as shown below. $ chmod u+r,g+x filename 3. Remove permission from a file/directory Following example removes read and write permission for the user. $ chmod u-rx filename 4. Change permission for all roles on a file/directory Following example assigns execute privilege to user, group and others (basically anybody can execute this file). $ chmod a+x filename 5. Make permission for a file same as another file (using reference) If you want to change a file permission same as another file, use the reference option as shown below. In this example, file2 s permission will be set exactly same as file1 s permission. $ chmod --reference=file1 file2 6. Apply the permission to all the files under a directory recursively Use option -R to change the permission recursively as shown below. $ chmod -R 755 directory-name/ 7. Change execute permission only on the directories (files are not affected) On a particular directory if you have multiple sub-directories and files, the following command will assign execute permission only to all the sub-directories in the current directory (not the files in the current directory). $ chmod u+x * Page 9 of 9

Permission and Ownership

Permission and Ownership Permission and Ownership 1. Understanding file and directory ownership Every file on your Linux system, including directories, is owned by a specific user and group. Therefore, file permissions are defined

More information

read: permitted to read the contents of directory ( view files and sub-directories in that directory ).

read: permitted to read the contents of directory ( view files and sub-directories in that directory ). File permissions Three file permissions:- read: permitted to read the contents of file. write: permitted to write to the file. execute: permitted to execute the file as a program/script. Three directory

More information

Exploring UNIX: Session 3

Exploring UNIX: Session 3 Exploring UNIX: Session 3 UNIX file system permissions UNIX is a multi user operating system. This means several users can be logged in simultaneously. For obvious reasons UNIX makes sure users cannot

More information

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

CST8207: GNU/Linux Operating Systems I Lab Six Linux File System Permissions. Linux File System Permissions (modes) - Part 1 Student Name: Lab Section: Linux File System Permissions (modes) - Part 1 Due Date - Upload to Blackboard by 8:30am Monday March 12, 2012 Submit the completed lab to Blackboard following the Rules for

More information

Introduction to Unix May 24, 2008

Introduction to Unix May 24, 2008 Introduction to Unix May 24, 2008 Exercises: Privileges REFERENCE Reference: Shah, Steve, "Linux Administration: A Beginner's Guide", 2nd. ed., Osborne press, New York, NY. If you look at files in a directory

More information

Exercise Sheet 2. (Classifications of Operating Systems)

Exercise Sheet 2. (Classifications of Operating Systems) Exercise Sheet 2 Exercise 1 (Classifications of Operating Systems) 1. At any given moment, only a single program can be executed. What is the technical term for this operation mode? 2. What are half multi-user

More information

A Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

A Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers A Big Step Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Copyright 2006 2009 Stewart Weiss What a shell really does Here is the scoop on shells. A shell is a program

More information

Chapter 8: Security under Linux

Chapter 8: Security under Linux Chapter 8: Security under Linux 8.1 File and Password security Linux security may be divided into two major parts: a) Password security b) File security 8.1.1 Password security To connect to a Linux system

More information

Scripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

Scripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Scripting Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Adapted from Practical Unix and Programming Hunter College Copyright 2006 2009 Stewart Weiss What a shell

More information

CSN08101 Digital Forensics. Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

CSN08101 Digital Forensics. Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak CSN08101 Digital Forensics Lecture 2: Essential Linux for Forensics Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak Essential Linux for Forensics You will learn in this lecture: Essential

More information

Basic File Attributes

Basic File Attributes Basic File Attributes The UNIX file system allows the user to access other files not belonging to them and without infringing on security. A file has a number of attributes (properties) that are stored

More information

The Unix Shell. Permissions

The Unix Shell. Permissions The Unix Shell Copyright Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See http://software-carpentry.org/license.html for more information. shell shell pwd,

More information

I/O and Shell Scripting

I/O and Shell Scripting I/O and Shell Scripting File Descriptors Redirecting Standard Error Shell Scripts Making a Shell Script Executable Specifying Which Shell Will Run a Script Comments in Shell Scripts File Descriptors Resources

More information

Operating Systems, Unix Files and Commands SEEM

Operating Systems, Unix Files and Commands SEEM Operating Systems, Unix Files and Commands SEEM 3460 1 Major Components of Operating Systems (OS) Process management Resource management CPU Memory Device File system Bootstrapping SEEM 3460 2 Programs

More information

Outline. Structure of a UNIX command

Outline. Structure of a UNIX command Outline Structure of Unix Commands Command help (man) Log on (terminal vs. graphical) System information (utility) File and directory structure (path) Permission (owner, group, rwx) File and directory

More information

Operating systems fundamentals - B10

Operating systems fundamentals - B10 Operating systems fundamentals - B10 David Kendall Northumbria University David Kendall (Northumbria University) Operating systems fundamentals - B10 1 / 12 Introduction Basics of protection and security

More information

Linux & Shell Programming 2014

Linux & Shell Programming 2014 Practical No : 1 Enrollment No: Group : A Practical Problem Write a date command to display date in following format: (Consider current date as 4 th January 2014) 1. dd/mm/yy hh:mm:ss 2. Today's date is:

More information

CHAPTER 1 UNIX FOR NONPROGRAMMERS

CHAPTER 1 UNIX FOR NONPROGRAMMERS CHAPTER 1 UNIX FOR NONPROGRAMMERS The man command is used to display the manual entry associated with word entered as argument. The -k option is used displays a list of manual entries that contain entered

More information

CISC 220 fall 2011, set 1: Linux basics

CISC 220 fall 2011, set 1: Linux basics CISC 220: System-Level Programming instructor: Margaret Lamb e-mail: malamb@cs.queensu.ca office: Goodwin 554 office phone: 533-6059 (internal extension 36059) office hours: Tues/Wed/Thurs 2-3 (this week

More information

Introduction: What is Unix?

Introduction: What is Unix? Introduction Introduction: What is Unix? An operating system Developed at AT&T Bell Labs in the 1960 s Command Line Interpreter GUIs (Window systems) are now available Introduction: Unix vs. Linux Unix

More information

commandname flags arguments

commandname flags arguments Unix Review, additional Unix commands CS101, Mock Introduction This handout/lecture reviews some basic UNIX commands that you should know how to use. A more detailed description of this and other commands

More information

Files (review) and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

Files (review) and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1 Files (review) and Regular Expressions Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 midterms (Feb 11 and April 1) Files and Permissions Regular Expressions 2 Sobel, Chapter 6 160_pathnames.html

More information

Lecture 2b. Pathnames, files, special characters in filenames, and file permissions. COP 3353 Introduction to UNIX, FALL 2013

Lecture 2b. Pathnames, files, special characters in filenames, and file permissions. COP 3353 Introduction to UNIX, FALL 2013 Lecture 2b Pathnames, files, special characters in filenames, and file permissions. COP 3353 Introduction to UNIX, FALL 2013 Files Files A well defined repository of information Program or component of

More information

CENG 334 Computer Networks. Laboratory I Linux Tutorial

CENG 334 Computer Networks. Laboratory I Linux Tutorial CENG 334 Computer Networks Laboratory I Linux Tutorial Contents 1. Logging In and Starting Session 2. Using Commands 1. Basic Commands 2. Working With Files and Directories 3. Permission Bits 3. Introduction

More information

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209 CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209 What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System

More information

Seeing file permission/ownership ls -l (Shows the long listing of a file/directory, which allows you to see file permission & ownership)

Seeing file permission/ownership ls -l (Shows the long listing of a file/directory, which allows you to see file permission & ownership) Objective 104.5 Manage file permission and ownership by Christine Bresnahan: Christine-Bresnahan.com Manage access permissions on regular and special files as well as directories. Use access modes such

More information

genome[phd14]:/home/people/phd14/alignment >

genome[phd14]:/home/people/phd14/alignment > Unix Introduction to Unix Shell There is a special type of window called shell or terminalwindow. Terminal windows are the principal vehicle of interaction with a UNIX machine. Their function is to perform

More information

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

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions Lanka Education and Research Network Linux Architecture, Linux File System, Linux Basic Commands 28 th November 2016 Dilum Samarasinhe () Overview History of Linux Linux Architecture Linux File System

More information

SECTION -C. Getting Started with UNIX

SECTION -C. Getting Started with UNIX Lecture 15 SECTION -C Getting Started with UNIX Introduction Changing permission modes Absolute & Relative Permissions Changing file permissions : chmod A file or directory is created with a default set

More information

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used: Linux Tutorial How to read the examples When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used: $ application file.txt

More information

CS246 Spring14 Programming Paradigm Notes on Linux

CS246 Spring14 Programming Paradigm Notes on Linux 1 Unix History 1965: Researchers from Bell Labs and other organizations begin work on Multics, a state-of-the-art interactive, multi-user operating system. 1969: Bell Labs researchers, losing hope for

More information

DAVE LIDDAMENT INTRODUCTION TO BASH

DAVE LIDDAMENT INTRODUCTION TO BASH DAVE LIDDAMENT INTRODUCTION TO BASH @daveliddament FORMAT Short lectures Practical exercises (help each other) Write scripts LEARNING OBJECTIVES What is Bash When should you use Bash Basic concepts of

More information

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

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers Review of the Linux File System and Linux Commands 1. Introduction Becoming adept at using the Linux OS requires gaining familiarity

More information

Linux Tutorial #6. -rw-r csce_user csce_user 20 Jan 4 09:15 list1.txt -rw-r csce_user csce_user 26 Jan 4 09:16 list2.

Linux Tutorial #6. -rw-r csce_user csce_user 20 Jan 4 09:15 list1.txt -rw-r csce_user csce_user 26 Jan 4 09:16 list2. File system access rights Linux Tutorial #6 Linux provides file system security using a three- level system of access rights. These special codes control who can read/write/execute every file and directory

More information

Welcome to Linux. Lecture 1.1

Welcome to Linux. Lecture 1.1 Welcome to Linux Lecture 1.1 Some history 1969 - the Unix operating system by Ken Thompson and Dennis Ritchie Unix became widely adopted by academics and businesses 1977 - the Berkeley Software Distribution

More information

CS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010

CS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010 Lecture 2 Fall 2010 Hussam Abu-Libdeh based on slides by David Slater September 10, 2010 Last Time We had a brief discussion On The Origin of Species *nix systems Today We roll our sleeves and get our

More information

CENG393 Computer Networks Labwork 1

CENG393 Computer Networks Labwork 1 CENG393 Computer Networks Labwork 1 Linux is the common name given to a large family of operating systems. All Linux-based operating systems are essentially a large set of computer software that are bound

More information

A Brief Introduction to Unix

A Brief Introduction to Unix A Brief Introduction to Unix Sean Barag Drexel University March 30, 2011 Sean Barag (Drexel University) CS 265 - A Brief Introduction to Unix March 30, 2011 1 / 17 Outline 1 Directories

More information

CS4350 Unix Programming. Outline

CS4350 Unix Programming. Outline Outline Unix Management Files and file systems Structure of Unix Commands Command help (man) Log on (terminal vs. graphical) System information (utility) File and directory structure (path) Permission

More information

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program Using UNIX. UNIX is mainly a command line interface. This means that you write the commands you want executed. In the beginning that will seem inferior to windows point-and-click, but in the long run the

More information

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

Outline. UNIX security ideas Users and groups File protection Setting temporary privileges. Examples. Permission bits Program language components UNIX security Ulf Larson (modified by Erland Jonsson/Magnus Almgren) Computer security group Dept. of Computer Science and Engineering Chalmers University of Technology, Sweden Outline UNIX security ideas

More information

Basic File Attributes

Basic File Attributes Basic File Attributes The UNIX file system allows the user to access other files not belonging to them and without infringing on security. A file has a number of attributes (properties) that are stored

More information

Unix Groups and Users

Unix Groups and Users CHMOD TUTORIAL AND XOOPS FILE SECURITIES The Xoops Site Security Guide has dealt with securities issues almost exclusively about possible intrusions or threats from outside of your Xoops site or server.

More information

ADVANCED LINUX SYSTEM ADMINISTRATION

ADVANCED LINUX SYSTEM ADMINISTRATION Lab Assignment 1 Corresponding to Topic 2, The Command Line L1 Main goals To get used to the command line. To gain basic skills with the system shell. To understand some of the basic tools of system administration.

More information

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: ~

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: ~ Introduction to Open Source Software Development Spring semester, 2017 School of Computer Science and Engineering, Pusan National University Joon-Seok Kim LINUX: COMMANDS Review Lab #1 2 Create Directories

More information

5/8/2012. Encryption-based Protection. Protection based on Access Permission (Contd) File Security, Setting and Using Permissions Chapter 9

5/8/2012. Encryption-based Protection. Protection based on Access Permission (Contd) File Security, Setting and Using Permissions Chapter 9 File Security, Setting and Using Permissions Chapter 9 To show the three protection and security mechanisms that UNIX provides To describe the types of users of a UNIX file To discuss the basic operations

More information

Set 1 MCQ Which command is used to sort the lines of data in a file in reverse order A) sort B) sh C) st D) sort -r

Set 1 MCQ Which command is used to sort the lines of data in a file in reverse order A) sort B) sh C) st D) sort -r 1. Which symbol will be used with grep command to match the pattern pat at the beginning of a line? A) ^pat B) $pat C) pat$ D) pat^ 2. Which command is used to sort the lines of data in a file in reverse

More information

Introduction to Linux

Introduction to Linux Introduction to Linux Mukesh Pund Principal Scientist, NISCAIR, New Delhi, India History In 1969, a team of developers developed a new operating system called Unix which was written using C Linus Torvalds,

More information

CSE 303 Lecture 4. users/groups; permissions; intro to shell scripting. read Linux Pocket Guide pp , 25-27, 61-65, , 176

CSE 303 Lecture 4. users/groups; permissions; intro to shell scripting. read Linux Pocket Guide pp , 25-27, 61-65, , 176 CSE 303 Lecture 4 users/groups; permissions; intro to shell scripting read Linux Pocket Guide pp. 19-20, 25-27, 61-65, 118-119, 176 slides created by Marty Stepp http://www.cs.washington.edu/303/ 1 Lecture

More information

12.1 UNDERSTANDING UNIX SHELL PROGRAMMING LANGUAGE: AN INTRODUCTION Writing a Simple Script Executing a Script

12.1 UNDERSTANDING UNIX SHELL PROGRAMMING LANGUAGE: AN INTRODUCTION Writing a Simple Script Executing a Script 12 Shell Programming This chapter concentrates on shell programming. It explains the capabilities of the shell as an interpretive high-level language. It describes shell programming constructs and particulars.

More information

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

CSE 390a Lecture 3. Multi-user systems; remote login; editors; users/groups; permissions CSE 390a Lecture 3 Multi-user systems; remote login; editors; users/groups; permissions slides created by Marty Stepp, modified by Jessica Miller and Ruth Anderson http://www.cs.washington.edu/390a/ 1

More information

Privileges: who can control what

Privileges: who can control what Privileges: who can control what Introduction to Unix May 24, 2008, Morocco Hervey Allen Goal Understand the following: The Unix security model How a program is allowed to run Where user and group information

More information

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209 CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209 What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System

More information

Introduction to Unix: Fundamental Commands

Introduction to Unix: Fundamental Commands Introduction to Unix: Fundamental Commands Ricky Patterson UVA Library Based on slides from Turgut Yilmaz Istanbul Teknik University 1 What We Will Learn The fundamental commands of the Unix operating

More information

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

Operating Systems Lab 1 (Users, Groups, and Security) Operating Systems Lab 1 (Users, Groups, and Security) Overview This chapter covers the most common commands related to users, groups, and security. It will also discuss topics like account creation/deletion,

More information

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

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT Unix as a Platform Exercises + Solutions Course Code: OS 01 UNXPLAT Working with Unix Most if not all of these will require some investigation in the man pages. That's the idea, to get them used to looking

More information

Common UNIX Commands. Unix. User Interfaces. Unix Commands Winter COMP 1270 Computer Usage II 9-1. Using UNIX. Unix has a command line interface

Common UNIX Commands. Unix. User Interfaces. Unix Commands Winter COMP 1270 Computer Usage II 9-1. Using UNIX. Unix has a command line interface Common UNIX Commands Using UNIX Unix Unix has a command line interface Unix commands must be typed Similar to the DOS operating system for PC s Compare to the Graphical User Interface (GUI) used by Windows,

More information

Group Editing of Files and Web Sites

Group Editing of Files and Web Sites Introduction Some research groups like to maintain a project/research group web page. We recommend that a single individual perform this task. Any member of the group may contribute and provide edits for

More information

UTA Tech Orientation Spring 2019

UTA Tech Orientation Spring 2019 UTA Tech Orientation Spring 2019 Overview Why is Tech Stuff Important? The Filesystem Shell Commands File Permissions Miscellaneous Why is Tech Stuff Important? Why is TA Tech Stuff Important? Different

More information

You will automatically be in your user (home) directory when you login.

You will automatically be in your user (home) directory when you login. Directory structure / (root) bin dev etc lib users users2 tmp These directories typically contain system libraries, executable binary files, device handlers and drivers, etc. The user home directories

More information

The Unix Shell & Shell Scripts

The Unix Shell & Shell Scripts The Unix Shell & Shell Scripts You should do steps 1 to 7 before going to the lab. Use the Linux system you installed in the previous lab. In the lab do step 8, the TA may give you additional exercises

More information

TECH 4272 Operating Systems

TECH 4272 Operating Systems TECH 4272 Lecture 3 2 Todd S. Canaday Adjunct Professor Herff College of Engineering sudo sudo is a program for Unix like computer operating systems that allows users to run programs with the security

More information

Chapter-3. Introduction to Unix: Fundamental Commands

Chapter-3. Introduction to Unix: Fundamental Commands Chapter-3 Introduction to Unix: Fundamental Commands What You Will Learn The fundamental commands of the Unix operating system. Everything told for Unix here is applicable to the Linux operating system

More information

UNIX Administration Course

UNIX Administration Course UNIX Administration Course UNIX Fundamentals: File Ownership Copyright 1999 by Ian Mapleson BSc. Version 1.0 mapleson@gamers.org Tel: (+44) (0)1772 893297 Fax: (+44) (0)1772 892913 WWW: http://www.futuretech.vuurwerk.nl/

More information

CS Fundamentals of Programming II Fall Very Basic UNIX

CS Fundamentals of Programming II Fall Very Basic UNIX CS 215 - Fundamentals of Programming II Fall 2012 - Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the CS (Project) Lab (KC-265)

More information

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

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018 GNU/Linux 101 Casey McLaughlin Research Computing Center Spring Workshop Series 2018 rccworkshop IC;3df4mu bash-2.1~# man workshop Linux101 RCC Workshop L101 OBJECTIVES - Operating system concepts - Linux

More information

Understanding bash. Prof. Chris GauthierDickey COMP 2400, Fall 2008

Understanding bash. Prof. Chris GauthierDickey COMP 2400, Fall 2008 Understanding bash Prof. Chris GauthierDickey COMP 2400, Fall 2008 How does bash start? It begins by reading your configuration files: If it s an interactive login-shell, first /etc/profile is executed,

More information

Goals for This Lecture:

Goals for This Lecture: Goals for This Lecture: Understand how to log in remotely with SSH Understand how to transfer files with SCP Learn how to log in from SINC site windows PC s with XWIN32 Understand the long form listings

More information

Unix Introduction to UNIX

Unix Introduction to UNIX Unix Introduction to UNIX Get Started Introduction The UNIX operating system Set of programs that act as a link between the computer and the user. Developed in 1969 by a group of AT&T employees Various

More information

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

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT Unix as a Platform Exercises Course Code: OS-01-UNXPLAT Working with Unix 1. Use the on-line manual page to determine the option for cat, which causes nonprintable characters to be displayed. Run the command

More information

Files

Files http://www.cs.fsu.edu/~langley/cop3353-2013-1/reveal.js-2013-02-11/02.html?print-pdf 02/11/2013 10:55 AM Files A normal "flat" file is a collection of information. It's usually stored somewhere reasonably

More information

UNIX File Hierarchy: Structure and Commands

UNIX File Hierarchy: Structure and Commands UNIX File Hierarchy: Structure and Commands The UNIX operating system organizes files into a tree structure with a root named by the character /. An example of the directory tree is shown below. / bin

More information

User Commands ls ( 1 )

User Commands ls ( 1 ) NAME ls list contents of directory SYNOPSIS /usr/bin/ls [-aabccdffghillmnopqrrstux1@] [file...] /usr/xpg4/bin/ls [-aabccdffghillmnopqrrstux1@] [file...] DESCRIPTION For each file that is a directory, ls

More information

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs Summer 2010 Department of Computer Science and Engineering York University Toronto June 29, 2010 1 / 36 Table of contents 1 2 3 4 2 / 36 Our goal Our goal is to see how we can use Unix as a tool for developing

More information

Unix Handouts. Shantanu N Kulkarni

Unix Handouts. Shantanu N Kulkarni Unix Handouts Shantanu N Kulkarni Abstract These handouts are meant to be used as a study aid during my class. They are neither complete nor sincerely accurate. The idea is that the participants should

More information

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

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester Linux Essentials Programming and Data Structures Lab M Tech CS First Year, First Semester Adapted from PDS Lab 2014 and 2015 Login, Logout, Password $ ssh mtc16xx@192.168.---.--- $ ssh X mtc16xx@192.168.---.---

More information

LOG ON TO LINUX AND LOG OFF

LOG ON TO LINUX AND LOG OFF EXPNO:1A LOG ON TO LINUX AND LOG OFF AIM: To know how to logon to Linux and logoff. PROCEDURE: Logon: To logon to the Linux system, we have to enter the correct username and password details, when asked,

More information

A Brief Introduction to the Linux Shell for Data Science

A Brief Introduction to the Linux Shell for Data Science A Brief Introduction to the Linux Shell for Data Science Aris Anagnostopoulos 1 Introduction Here we will see a brief introduction of the Linux command line or shell as it is called. Linux is a Unix-like

More information

Introduction to Linux Workshop 1

Introduction to Linux Workshop 1 Introduction to Linux Workshop 1 The George Washington University SEAS Computing Facility Created by Jason Hurlburt, Hadi Mohammadi, Marco Suarez hurlburj@gwu.edu Logging In The lab computers will authenticate

More information

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

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version... Contents Note: pay attention to where you are........................................... 1 Note: Plaintext version................................................... 1 Hello World of the Bash shell 2 Accessing

More information

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the EECS labs that dual boot

More information

LAB 8 (Aug 4/5) Unix Utilities

LAB 8 (Aug 4/5) Unix Utilities Aug 4/5 Due: Aug 11 in class Name: CSE number: LAB 8 (Aug 4/5) Unix Utilities The purpose of this lab exercise is for you to get some hands-on experience on using some fundamental Unix utilities (commands).

More information

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

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech Unix File System Class Meeting 2 * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech Unix File System The file system is your interface to: physical

More information

Introduction to the Linux Command Line

Introduction to the Linux Command Line Introduction to the Linux Command Line May, 2015 How to Connect (securely) ssh sftp scp Basic Unix or Linux Commands Files & directories Environment variables Not necessarily in this order.? Getting Connected

More information

find Command as Admin Security Tool

find Command as Admin Security Tool find Command as Admin Security Tool Dr. Bill Mihajlovic INCS-620 Operating Systems Security find Command find command searches for the file or files that meet certain condition. like: Certain name Certain

More information

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Unix Filesystem. January 26 th, 2004 Class Meeting 2 Unix Filesystem January 26 th, 2004 Class Meeting 2 * Notes adapted by Christian Allgood from previous work by other members of the CS faculty at Virginia Tech Unix Filesystem! The filesystem is your interface

More information

Introduction. SSH Secure Shell Client 1

Introduction. SSH Secure Shell Client 1 SSH Secure Shell Client 1 Introduction An SSH Secure Shell Client is a piece of software that allows a user to do a number of functions. Some of these functions are: file transferring, setting permissions,

More information

LAB 8 (Aug 4/5) Unix Utilities

LAB 8 (Aug 4/5) Unix Utilities Aug 4/5 Due: Aug 11 in class Name: CSE number: LAB 8 (Aug 4/5) Unix Utilities The purpose of this lab exercise is for you to get some hands-on experience on using some fundamental Unix utilities (commands).

More information

Unix Basics. UNIX Introduction. Lecture 14

Unix Basics. UNIX Introduction. Lecture 14 Unix Basics Lecture 14 UNIX Introduction The UNIX operating system is made up of three parts; the kernel, the shell and the programs. The kernel of UNIX is the hub of the operating system: it allocates

More information

UNIX: Departmental Library Management on AIX

UNIX: Departmental Library Management on AIX Departmental Library Management on AIX SYNOPSIS This document describes the basics of departmental library management as it is performed on the AIX operating system with the utilities provided by Information

More information

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group.

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group. CMPS 12L Introduction to Programming Lab Assignment 2 We have three goals in this assignment: to learn about file permissions in Unix, to get a basic introduction to the Andrew File System and it s directory

More information

Listing Directory Attributes. Bamuengine.com Page 1. BY Prof. P. Katkar, DIEMS, AURANGABAD

Listing Directory Attributes. Bamuengine.com Page 1. BY Prof. P. Katkar, DIEMS, AURANGABAD Unit II File Attributes and VI Editor of UNIX. --------------------------------------------------------------------------------------------------- The UNIX file system allows the user to access other files

More information

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

bash startup files Linux/Unix files stty Todd Kelley CST8207 Todd Kelley 1 bash startup files Linux/Unix files stty Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 midterms (Feb 27 and April 10) bash startup files More Linux Files review stty 2 We customize our

More information

CENG200 - Lab 2: Security, Simple Web Pages

CENG200 - Lab 2: Security, Simple Web Pages Out: Sept 12, 2016 Due: Sept 26, 2016 (start of lecture) Preliminary Steps CENG200 - Lab 2: Security, Simple Web Pages A. When you log in for this lab, perform the following actions (one time only) chmod

More information

Practical 4. Linux Commands: Working with Directories

Practical 4. Linux Commands: Working with Directories Practical 4 Linux Commands: Working with Directories 1. pwd: pwd stands for Print Working Directory. As the name states, command pwd prints the current working directory or simply the directory user is,

More information

Protection. CSE473 - Spring Professor Jaeger. CSE473 Operating Systems - Spring Professor Jaeger

Protection. CSE473 - Spring Professor Jaeger.   CSE473 Operating Systems - Spring Professor Jaeger Protection CSE473 - Spring 2008 Professor Jaeger www.cse.psu.edu/~tjaeger/cse473-s08/ Protection Protect yourself from untrustworthy users in a common space They may try to access your resources Or modify

More information

The Unix Environment for Programming (COMP433)

The Unix Environment for Programming (COMP433) The Unix Environment for Programming (COMP433) Student's Practical Manual Dr. Mohamed Ben Laroussi Aissa m.issa@unizwa.edu.om Room 11 I- 13 Spring 2017 1 Textbook Topic # Topic Page 1 Introduction 2 3

More information

Permissions and Links

Permissions and Links Permissions and Links The root account Setuid and Setgid Permissions Setting Setuid and Setgid with chmod Directory Access Permissions Links o Two Types of Links o The ln command o Removing a link The

More information

Hardware. Ahmet Burak Can Hacettepe University. Operating system. Applications programs. Users

Hardware. Ahmet Burak Can Hacettepe University. Operating system. Applications programs. Users Operating System Security Ahmet Burak Can Hacettepe University abc@hacettepe.edu.tr Computer System Components Hardware Provides basic computing resources (CPU, memory, I/O devices). Operating system Controls

More information

Essential Linux Shell Commands

Essential Linux Shell Commands Essential Linux Shell Commands Special Characters Quoting and Escaping Change Directory Show Current Directory List Directory Contents Working with Files Working with Directories Special Characters There

More information