SlideShare a Scribd company logo
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Introduction to Linux
by Ashish Bhatia
TechBuddy Consulting Pvt. Ltd.
19-21 June 2010
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Why learn Linux?
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
What is OS?
What is OS?
1 BIOS - Boot Loader - OS
2 Hardware - OS - Application Software - User
3 multi-user?
4 multi-tasking?
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
History of GNU/Linux
based on ideas from UNIX (originated in 1969 at AT&T)
created by Linus Torvalds in 1991
General Public License
GPL
distribution of source code with binary is must
more details later
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Files and Processes
A running program is a process
it has unique process identifier (PID)
Everything else is file
even devices like mouse, keyboard etc.
every file has a unique inode number in Linux
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
File Hierarchy
Unlike windows(except recent versions) where data storage is
partitioned into various drives
In Linux all (accessible) data is under /
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
File Hierarchy
/ The ancestor of all directories on the system
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
File Hierarchy
/ The ancestor of all directories on the system
/bin Essential tools and other programs (or binaries)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
File Hierarchy
/ The ancestor of all directories on the system
/bin Essential tools and other programs (or binaries)
/dev Files representing the system’s various hardware devices
(eg. /dev/dvd)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
File Hierarchy
/ The ancestor of all directories on the system
/bin Essential tools and other programs (or binaries)
/dev Files representing the system’s various hardware devices
(eg. /dev/dvd)
/etc Misc system configuration files, startup files (eg.
/etc/networking)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
File Hierarchy
/ The ancestor of all directories on the system
/bin Essential tools and other programs (or binaries)
/dev Files representing the system’s various hardware devices
(eg. /dev/dvd)
/etc Misc system configuration files, startup files (eg.
/etc/networking)
/home The home dir for all of the system’s users
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
File Hierarchy
/ The ancestor of all directories on the system
/bin Essential tools and other programs (or binaries)
/dev Files representing the system’s various hardware devices
(eg. /dev/dvd)
/etc Misc system configuration files, startup files (eg.
/etc/networking)
/home The home dir for all of the system’s users
/proc Files that give information about current system
processes
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
File Hierarchy
/ The ancestor of all directories on the system
/bin Essential tools and other programs (or binaries)
/dev Files representing the system’s various hardware devices
(eg. /dev/dvd)
/etc Misc system configuration files, startup files (eg.
/etc/networking)
/home The home dir for all of the system’s users
/proc Files that give information about current system
processes
/root superuser’s home directory, whose username is root
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
File Hierarchy
/ The ancestor of all directories on the system
/bin Essential tools and other programs (or binaries)
/dev Files representing the system’s various hardware devices
(eg. /dev/dvd)
/etc Misc system configuration files, startup files (eg.
/etc/networking)
/home The home dir for all of the system’s users
/proc Files that give information about current system
processes
/root superuser’s home directory, whose username is root
/tmp Temp files
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
File Hierarchy
/ The ancestor of all directories on the system
/bin Essential tools and other programs (or binaries)
/dev Files representing the system’s various hardware devices
(eg. /dev/dvd)
/etc Misc system configuration files, startup files (eg.
/etc/networking)
/home The home dir for all of the system’s users
/proc Files that give information about current system
processes
/root superuser’s home directory, whose username is root
/tmp Temp files
/usr Subdir with files related to user tools and applications
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Linux Alternative for Windows
Internet Explorer = Firefox
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Linux Alternative for Windows
Internet Explorer = Firefox
Outlook Express = Thunderbird
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Linux Alternative for Windows
Internet Explorer = Firefox
Outlook Express = Thunderbird
Google Talk = Pidgin (and Skype)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Linux Alternative for Windows
Internet Explorer = Firefox
Outlook Express = Thunderbird
Google Talk = Pidgin (and Skype)
media player = amarok
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Linux Alternative for Windows
Internet Explorer = Firefox
Outlook Express = Thunderbird
Google Talk = Pidgin (and Skype)
media player = amarok
Microsoft Office = Open Office
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Linux Alternative for Windows
Internet Explorer = Firefox
Outlook Express = Thunderbird
Google Talk = Pidgin (and Skype)
media player = amarok
Microsoft Office = Open Office
Notepad = kate,vim
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Linux Alternative for Windows
Internet Explorer = Firefox
Outlook Express = Thunderbird
Google Talk = Pidgin (and Skype)
media player = amarok
Microsoft Office = Open Office
Notepad = kate,vim
A more comprehensive list at
http://wiki.linuxquestions.org/wiki/
Linux software equivalent to Windows software
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
What is a user
A user represents a real-world entity and it has
username (and user ID)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
What is a user
A user represents a real-world entity and it has
username (and user ID)
group (and group ID)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
What is a user
A user represents a real-world entity and it has
username (and user ID)
group (and group ID)
Password
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
What is a user
A user represents a real-world entity and it has
username (and user ID)
group (and group ID)
Password
Home Dir
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
What is a user
A user represents a real-world entity and it has
username (and user ID)
group (and group ID)
Password
Home Dir
Default Shell
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
What is a user
A user represents a real-world entity and it has
username (and user ID)
group (and group ID)
Password
Home Dir
Default Shell
User Details
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Processes
GNU/Linux is a multi-user OS
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Processes
GNU/Linux is a multi-user OS
Everything is a file or a process
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Processes
GNU/Linux is a multi-user OS
Everything is a file or a process
Each process must specify which user is the owner
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Processes
GNU/Linux is a multi-user OS
Everything is a file or a process
Each process must specify which user is the owner
No one except owner has right to access that process*
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Processes
GNU/Linux is a multi-user OS
Everything is a file or a process
Each process must specify which user is the owner
No one except owner has right to access that process*
what about files?
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Files
Each file has three (boolean) permissions
Read(r)
Write(w)
Execute(x)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Files
Each file has three (boolean) permissions
Read(r)
Write(w)
Execute(x)
All users can be grouped into
Owner(u)
Group (members) (g)
Others (o)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Files
Each file has three (boolean) permissions
Read(r)
Write(w)
Execute(x)
All users can be grouped into
Owner(u)
Group (members) (g)
Others (o)
9 bits
r w x r w x r w x
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Files
Each file has three (boolean) permissions
Read(r)
Write(w)
Execute(x)
All users can be grouped into
Owner(u)
Group (members) (g)
Others (o)
9 bits
r w x r w x r w x
Super-user bypasses file permissions
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
A few examples
chmod 600 file1
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
A few examples
chmod 600 file1
chmod 400 file2
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
A few examples
chmod 600 file1
chmod 400 file2
chmod 711 file3
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
A few examples
chmod 600 file1
chmod 400 file2
chmod 711 file3
chmod 644 file4
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
A few examples
chmod 600 file1
chmod 400 file2
chmod 711 file3
chmod 644 file4
chmod -R 644 dir1
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Files
File Permissions on Dir
Execute permission is required for a user to cd into a directory
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Files
File Permissions on Dir
Execute permission is required for a user to cd into a directory
Execute-only permission allows a user to access the files in a
directory as long as the user knows the names of the files in
the directory(and the user is allowed to read the files)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Files
File Permissions on Dir
Execute permission is required for a user to cd into a directory
Execute-only permission allows a user to access the files in a
directory as long as the user knows the names of the files in
the directory(and the user is allowed to read the files)
Execute+Read permission is required to view files contained
in dir (eg. ls)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Files
File Permissions on Dir
Execute permission is required for a user to cd into a directory
Execute-only permission allows a user to access the files in a
directory as long as the user knows the names of the files in
the directory(and the user is allowed to read the files)
Execute+Read permission is required to view files contained
in dir (eg. ls)
Execute+Read+Write permission allows the user to create,
delete, or modify any files or subdirectories(even if the file or
subdirectory is owned by another user)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Files
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Files
Something More
SetUID(u+s)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Files
Something More
SetUID(u+s)
SetGID(g+s)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Users and Files
Something More
SetUID(u+s)
SetGID(g+s)
Sticky Bit(t)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Is Linux (really) secure?
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Is Linux (really) secure?
Security of system or data?
1 Security by design
designed for connectivity and security
users do not login into admin account (by default)
users do not install packages from unverified sources
some distros require admin account even for connecting usb
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Is Linux (really) secure?
Security of system or data?
1 Security by design
designed for connectivity and security
users do not login into admin account (by default)
users do not install packages from unverified sources
some distros require admin account even for connecting usb
2 intelligent users
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Is Linux (really) secure?
Security of system or data?
1 Security by design
designed for connectivity and security
users do not login into admin account (by default)
users do not install packages from unverified sources
some distros require admin account even for connecting usb
2 intelligent users
3 Smaller market to target for attackers
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Shell
provides the traditional user interface for the Unix operating
system and for Unix-like systems
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Shell
provides the traditional user interface for the Unix operating
system and for Unix-like systems
Some popular shells
bash
ksh
csh
Unless mentioned all slides assume bash
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Process in Linux
Main Attributes
uid - user with whose permissions process executes
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Process in Linux
Main Attributes
uid - user with whose permissions process executes
pid - process id
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Process in Linux
Main Attributes
uid - user with whose permissions process executes
pid - process id
ppid - parent process id
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Process in Linux
Main Attributes
uid - user with whose permissions process executes
pid - process id
ppid - parent process id
terminal - to which process is attached
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Standard I/O
Every process has access to three (standard) files
stdin (usually keyboard) - 0
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Standard I/O
Every process has access to three (standard) files
stdin (usually keyboard) - 0
stdout (usually monitor) - 1
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Standard I/O
Every process has access to three (standard) files
stdin (usually keyboard) - 0
stdout (usually monitor) - 1
stderr (usually monitor) - 2
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
I/O Redirection
Standard I/O of the process can be redirected to other file(s)
cmd >filename
redirects output from stdout to filename
original contents of file are overwritten
use >>to append the output to original content
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
I/O Redirection
Standard I/O of the process can be redirected to other file(s)
cmd >filename
redirects output from stdout to filename
original contents of file are overwritten
use >>to append the output to original content
cmd 2>filename
redirects output from stderr to filename
original contents of file are overwritten
use >>to append the output to original content
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
I/O Redirection
Standard I/O of the process can be redirected to other file(s)
cmd >filename
redirects output from stdout to filename
original contents of file are overwritten
use >>to append the output to original content
cmd 2>filename
redirects output from stderr to filename
original contents of file are overwritten
use >>to append the output to original content
cmd <filename
redirects input from stdin to filename
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
I/O Redirection
Standard I/O of the process can be redirected to other file(s)
cmd >filename
redirects output from stdout to filename
original contents of file are overwritten
use >>to append the output to original content
cmd 2>filename
redirects output from stderr to filename
original contents of file are overwritten
use >>to append the output to original content
cmd <filename
redirects input from stdin to filename
use /dev/null as output file to discard the output
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(sequentially)
What are the possible cases?
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(sequentially)
What are the possible cases?
cmd1 ; cmd2
cmd2 is executed after completion of cmd1
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(sequentially)
What are the possible cases?
cmd1 ; cmd2
cmd2 is executed after completion of cmd1
cmd1 && cmd2
cmd2 is executed after successful completion of cmd1
eg. rm abc && mkdir abc
creates directory abc only if abc file is deleted successfully
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(sequentially)
What are the possible cases?
cmd1 ; cmd2
cmd2 is executed after completion of cmd1
cmd1 && cmd2
cmd2 is executed after successful completion of cmd1
eg. rm abc && mkdir abc
creates directory abc only if abc file is deleted successfully
cmd1 || cmd2
cmd2 is executed on un-successful completion of cmd1
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(sequentially)
What are the possible cases?
cmd1 ; cmd2
cmd2 is executed after completion of cmd1
cmd1 && cmd2
cmd2 is executed after successful completion of cmd1
eg. rm abc && mkdir abc
creates directory abc only if abc file is deleted successfully
cmd1 || cmd2
cmd2 is executed on un-successful completion of cmd1
cmd1 | cmd2
cmd2 is executed on successful completion of cmd1 and takes
output of cmd1 as its input
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(in parallel)
what is background mode?
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(in parallel)
what is background mode?
start process in background mode directly
using & at the end of command
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(in parallel)
what is background mode?
start process in background mode directly
using & at the end of command
start process normally (foreground)
press ˆz (stops the process)
execute bg (to start most recently stopped process in
background mode)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(in parallel)
Handling processes running in background
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(in parallel)
Handling processes running in background
jobs - print currently pending (running + stopped) jobs
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(in parallel)
Handling processes running in background
jobs - print currently pending (running + stopped) jobs
kill %1 - kills job corresponding to number 1 in the jobs
output
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(in parallel)
Handling processes running in background
jobs - print currently pending (running + stopped) jobs
kill %1 - kills job corresponding to number 1 in the jobs
output
fg - brings a background process back to foreground
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(in parallel)
More process handling
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(in parallel)
More process handling
ps [-ely] - see all processes of all users
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(in parallel)
More process handling
ps [-ely] - see all processes of all users
pstree - shows processes in tree-like (father-child) relation
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(in parallel)
More process handling
ps [-ely] - see all processes of all users
pstree - shows processes in tree-like (father-child) relation
top - show list of running processes interactively
q - quit
k - kill a process
signal -9 kill without warning
signal -15 kill after warning (allows cleanup)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(in parallel)
More process handling
ps [-ely] - see all processes of all users
pstree - shows processes in tree-like (father-child) relation
top - show list of running processes interactively
q - quit
k - kill a process
signal -9 kill without warning
signal -15 kill after warning (allows cleanup)
kill [signal] process-id
kill -9 process-id
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Executing multiple processes(in parallel)
More process handling
ps [-ely] - see all processes of all users
pstree - shows processes in tree-like (father-child) relation
top - show list of running processes interactively
q - quit
k - kill a process
signal -9 kill without warning
signal -15 kill after warning (allows cleanup)
kill [signal] process-id
kill -9 process-id
killall [signal] process-cmd-name
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Free Software
As defined by FSF (1986)
1 run the program (for any purpose)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Free Software
As defined by FSF (1986)
1 run the program (for any purpose)
2 study how the program works (and change it to your needs)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Free Software
As defined by FSF (1986)
1 run the program (for any purpose)
2 study how the program works (and change it to your needs)
3 redistribute copies
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Free Software
As defined by FSF (1986)
1 run the program (for any purpose)
2 study how the program works (and change it to your needs)
3 redistribute copies
4 improve the program and release your improvements to the
public
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Licenses
1 GNU General Purpose License
Disclaimer: I am not a legal expert
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Licenses
1 GNU General Purpose License
2 GNU Lesser General Purpose License
Disclaimer: I am not a legal expert
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Licenses
1 GNU General Purpose License
2 GNU Lesser General Purpose License
3 Apache License
Disclaimer: I am not a legal expert
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Licenses
1 GNU General Purpose License
2 GNU Lesser General Purpose License
3 Apache License
4 BSD License
Disclaimer: I am not a legal expert
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Licenses
1 GNU General Purpose License
2 GNU Lesser General Purpose License
3 Apache License
4 BSD License
5 lot of others
Disclaimer: I am not a legal expert
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
GNU GPL
1 most popular (and most sophisticated)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
GNU GPL
1 most popular (and most sophisticated)
2 a work derived from GPL licensed work must be licensed
under GPL
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
GNU GPL
1 most popular (and most sophisticated)
2 a work derived from GPL licensed work must be licensed
under GPL
3 linking to GPL code?
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
GNU LGPL
1 less restrictive than GPL
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
GNU LGPL
1 less restrictive than GPL
2 LGPL licensed code can be linked by non-(L)GPL code
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
GNU LGPL
1 less restrictive than GPL
2 LGPL licensed code can be linked by non-(L)GPL code
3 derivative work must still release code for personal use (of
customer)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
GNU LGPL
1 less restrictive than GPL
2 LGPL licensed code can be linked by non-(L)GPL code
3 derivative work must still release code for personal use (of
customer)
4 LGPL vs GPL? which one to use?
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
BSD
1 Very permissive
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
BSD
1 Very permissive
2 just give credits to the previous contributors
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
BSD
1 Very permissive
2 just give credits to the previous contributors
3 no need to release source-code
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
BSD
1 Very permissive
2 just give credits to the previous contributors
3 no need to release source-code
4 “If you want to give your software away for free, use BSD. If
you want to share your software, use the GPL”
(Courtesy:OSnews)
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Apache
1 Permissiveness same as BSD but legally more explicit
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Apache
1 Permissiveness same as BSD but legally more explicit
2 handles the problem of software patents
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Apache
1 Permissiveness same as BSD but legally more explicit
2 handles the problem of software patents
3 author of the code (automatically) gives up the right to any of
(his/her) patent used in the code
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Case 1
ACME systems internally uses CRM whose codebase is based
on a GPL based CRM. Can an employee of the company ask
for the source code?
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Case 2
Microspecial Inc. supplies embedded systems to the
government, as per the government orders they cannot release
the source code to anyone but their codebase is based on GPL
based code. What if someone asks for the source code? do
they have to give it?
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Case 3
Stickpoint Solutions released Office software 1.0 under GPL
and in the next version, they decide to move to BSD license?
can they do it?
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Case 4
Tivo used parts of Linux kernel code for its consumer
electronics product, so they had to release the source code
but they put on the hardware check to avoid customised code
from execution. Is this a violation of GPL?
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
Case 5
Web Ultimates released source code of CMS(web application)
under GPL, Web Peers Inc. used the code to develop their
website, do they have to release the source code of their
website?
Ashish Bhatia Introduction to Linux
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses
References
1 Linux Man Pages
2 The Linux Documentation Project
3 Free Software Foundation (FSF) website
Ashish Bhatia Introduction to Linux

More Related Content

PPTX
Linux fundamentals
PPTX
Introduction to Linux
PPT
A Quick Introduction to Linux
PPT
Linux history & features
PPTX
Introduction to linux at Introductory Bioinformatics Workshop
PPT
Linux training
PDF
Module 1 introduction to Linux
Linux fundamentals
Introduction to Linux
A Quick Introduction to Linux
Linux history & features
Introduction to linux at Introductory Bioinformatics Workshop
Linux training
Module 1 introduction to Linux

What's hot (20)

PDF
Module 3 Using Linux Softwares.
PPT
Linux: Basics OF Linux
PDF
Introduction to Linux for bioinformatics
PPT
Linux
PDF
Linux programming lecture_notes
PPT
Linux fundamentals Training
PPT
OS Lab: Introduction to Linux
PPTX
Linux.ppt
DOCX
Linux admin interview questions
PPTX
Linux basics part 1
PPTX
Linux Presentation
PDF
Linux Presentation
PDF
An Introduction To Linux
PPT
Linux presentation
PDF
Part 1 of 'Introduction to Linux for bioinformatics': Introduction
PPT
Linux Training Workshop
PPT
UNIX introduction
PPS
01 t1 s2_linux_lesson1
PPT
Linux lesson
Module 3 Using Linux Softwares.
Linux: Basics OF Linux
Introduction to Linux for bioinformatics
Linux
Linux programming lecture_notes
Linux fundamentals Training
OS Lab: Introduction to Linux
Linux.ppt
Linux admin interview questions
Linux basics part 1
Linux Presentation
Linux Presentation
An Introduction To Linux
Linux presentation
Part 1 of 'Introduction to Linux for bioinformatics': Introduction
Linux Training Workshop
UNIX introduction
01 t1 s2_linux_lesson1
Linux lesson
Ad

Viewers also liked (20)

PDF
{Community} Launch Asp.Net Ajax
PPT
Educacion Colombiana
PDF
Desert De Les Palmes 2ª Correcció
PPTX
Social Media in Higher Education - Barriers & Digital Literacy
PDF
{Community} Launch Visual Studio2008
PPT
solar system_yasmine
PDF
Livinbrand 2016 - Ivan Duškov, IPR Praha: Co dokáže branding velkých projektů
PDF
Focus On Turkey
KEY
User Testing Tactics
PPT
Googley Family Philanthropy
PPT
Informatika Power Point
PPT
Turismo y Sostenibilidad
PDF
2204
 
PPT
Workshop
PDF
The commoditization and fragmentation of the ia community
PDF
Mobile Information Architecture and Interaction Design (InfoCamp 2010)
PPTX
Un’applicazione mobileserver per la mappatura d’informazioni a supporto delle...
PDF
Livinbrand 2016 - Jakub Michl, Beneš & Michl: Jak prosazujeme branding ve fir...
PPTX
Entreprenuership
PPTX
Hacks to Be Heard
{Community} Launch Asp.Net Ajax
Educacion Colombiana
Desert De Les Palmes 2ª Correcció
Social Media in Higher Education - Barriers & Digital Literacy
{Community} Launch Visual Studio2008
solar system_yasmine
Livinbrand 2016 - Ivan Duškov, IPR Praha: Co dokáže branding velkých projektů
Focus On Turkey
User Testing Tactics
Googley Family Philanthropy
Informatika Power Point
Turismo y Sostenibilidad
2204
 
Workshop
The commoditization and fragmentation of the ia community
Mobile Information Architecture and Interaction Design (InfoCamp 2010)
Un’applicazione mobileserver per la mappatura d’informazioni a supporto delle...
Livinbrand 2016 - Jakub Michl, Beneš & Michl: Jak prosazujeme branding ve fir...
Entreprenuership
Hacks to Be Heard
Ad

Similar to Techbuddy: Introduction to Linux session (20)

PPT
Linux
PPT
Linux administration classes in mumbai
PDF
beginner.en.print
PDF
beginner.en.print
PDF
beginner.en.print
PPT
linux-lecture1.ppt
PDF
Linux introduction (eng)
DOCX
Linux technology
ODP
Basic orientation to Linux
PPT
chapter 3 linux-lecture.ppt
PPT
Chapter09 -- networking with unix and linux
PDF
Introduction to linux
PDF
Introduction to linux
PPT
User administration concepts and mechanisms
PDF
How to Audit Linux - Gene Kartavtsev, ISACA MN
PPT
Chapter 1 Overview of system administration.ppt
PPTX
ODP
Intro To Linux
PPT
LinuxTraining_26_Sept_2021.ppt
Linux
Linux administration classes in mumbai
beginner.en.print
beginner.en.print
beginner.en.print
linux-lecture1.ppt
Linux introduction (eng)
Linux technology
Basic orientation to Linux
chapter 3 linux-lecture.ppt
Chapter09 -- networking with unix and linux
Introduction to linux
Introduction to linux
User administration concepts and mechanisms
How to Audit Linux - Gene Kartavtsev, ISACA MN
Chapter 1 Overview of system administration.ppt
Intro To Linux
LinuxTraining_26_Sept_2021.ppt

Recently uploaded (20)

PDF
Empathic Computing: Creating Shared Understanding
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPT
Teaching material agriculture food technology
PDF
Approach and Philosophy of On baking technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Spectroscopy.pptx food analysis technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
cuic standard and advanced reporting.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
Empathic Computing: Creating Shared Understanding
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Building Integrated photovoltaic BIPV_UPV.pdf
MYSQL Presentation for SQL database connectivity
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Teaching material agriculture food technology
Approach and Philosophy of On baking technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
20250228 LYD VKU AI Blended-Learning.pptx
Spectroscopy.pptx food analysis technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
cuic standard and advanced reporting.pdf
Review of recent advances in non-invasive hemoglobin estimation
Unlocking AI with Model Context Protocol (MCP)
NewMind AI Weekly Chronicles - August'25 Week I
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
The AUB Centre for AI in Media Proposal.docx

Techbuddy: Introduction to Linux session

  • 1. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Introduction to Linux by Ashish Bhatia TechBuddy Consulting Pvt. Ltd. 19-21 June 2010 Ashish Bhatia Introduction to Linux
  • 2. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Why learn Linux? Ashish Bhatia Introduction to Linux
  • 3. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses What is OS? What is OS? 1 BIOS - Boot Loader - OS 2 Hardware - OS - Application Software - User 3 multi-user? 4 multi-tasking? Ashish Bhatia Introduction to Linux
  • 4. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses History of GNU/Linux based on ideas from UNIX (originated in 1969 at AT&T) created by Linus Torvalds in 1991 General Public License GPL distribution of source code with binary is must more details later Ashish Bhatia Introduction to Linux
  • 5. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Files and Processes A running program is a process it has unique process identifier (PID) Everything else is file even devices like mouse, keyboard etc. every file has a unique inode number in Linux Ashish Bhatia Introduction to Linux
  • 6. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses File Hierarchy Unlike windows(except recent versions) where data storage is partitioned into various drives In Linux all (accessible) data is under / Ashish Bhatia Introduction to Linux
  • 7. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses File Hierarchy / The ancestor of all directories on the system Ashish Bhatia Introduction to Linux
  • 8. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses File Hierarchy / The ancestor of all directories on the system /bin Essential tools and other programs (or binaries) Ashish Bhatia Introduction to Linux
  • 9. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses File Hierarchy / The ancestor of all directories on the system /bin Essential tools and other programs (or binaries) /dev Files representing the system’s various hardware devices (eg. /dev/dvd) Ashish Bhatia Introduction to Linux
  • 10. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses File Hierarchy / The ancestor of all directories on the system /bin Essential tools and other programs (or binaries) /dev Files representing the system’s various hardware devices (eg. /dev/dvd) /etc Misc system configuration files, startup files (eg. /etc/networking) Ashish Bhatia Introduction to Linux
  • 11. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses File Hierarchy / The ancestor of all directories on the system /bin Essential tools and other programs (or binaries) /dev Files representing the system’s various hardware devices (eg. /dev/dvd) /etc Misc system configuration files, startup files (eg. /etc/networking) /home The home dir for all of the system’s users Ashish Bhatia Introduction to Linux
  • 12. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses File Hierarchy / The ancestor of all directories on the system /bin Essential tools and other programs (or binaries) /dev Files representing the system’s various hardware devices (eg. /dev/dvd) /etc Misc system configuration files, startup files (eg. /etc/networking) /home The home dir for all of the system’s users /proc Files that give information about current system processes Ashish Bhatia Introduction to Linux
  • 13. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses File Hierarchy / The ancestor of all directories on the system /bin Essential tools and other programs (or binaries) /dev Files representing the system’s various hardware devices (eg. /dev/dvd) /etc Misc system configuration files, startup files (eg. /etc/networking) /home The home dir for all of the system’s users /proc Files that give information about current system processes /root superuser’s home directory, whose username is root Ashish Bhatia Introduction to Linux
  • 14. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses File Hierarchy / The ancestor of all directories on the system /bin Essential tools and other programs (or binaries) /dev Files representing the system’s various hardware devices (eg. /dev/dvd) /etc Misc system configuration files, startup files (eg. /etc/networking) /home The home dir for all of the system’s users /proc Files that give information about current system processes /root superuser’s home directory, whose username is root /tmp Temp files Ashish Bhatia Introduction to Linux
  • 15. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses File Hierarchy / The ancestor of all directories on the system /bin Essential tools and other programs (or binaries) /dev Files representing the system’s various hardware devices (eg. /dev/dvd) /etc Misc system configuration files, startup files (eg. /etc/networking) /home The home dir for all of the system’s users /proc Files that give information about current system processes /root superuser’s home directory, whose username is root /tmp Temp files /usr Subdir with files related to user tools and applications Ashish Bhatia Introduction to Linux
  • 16. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Linux Alternative for Windows Internet Explorer = Firefox Ashish Bhatia Introduction to Linux
  • 17. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Linux Alternative for Windows Internet Explorer = Firefox Outlook Express = Thunderbird Ashish Bhatia Introduction to Linux
  • 18. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Linux Alternative for Windows Internet Explorer = Firefox Outlook Express = Thunderbird Google Talk = Pidgin (and Skype) Ashish Bhatia Introduction to Linux
  • 19. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Linux Alternative for Windows Internet Explorer = Firefox Outlook Express = Thunderbird Google Talk = Pidgin (and Skype) media player = amarok Ashish Bhatia Introduction to Linux
  • 20. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Linux Alternative for Windows Internet Explorer = Firefox Outlook Express = Thunderbird Google Talk = Pidgin (and Skype) media player = amarok Microsoft Office = Open Office Ashish Bhatia Introduction to Linux
  • 21. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Linux Alternative for Windows Internet Explorer = Firefox Outlook Express = Thunderbird Google Talk = Pidgin (and Skype) media player = amarok Microsoft Office = Open Office Notepad = kate,vim Ashish Bhatia Introduction to Linux
  • 22. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Linux Alternative for Windows Internet Explorer = Firefox Outlook Express = Thunderbird Google Talk = Pidgin (and Skype) media player = amarok Microsoft Office = Open Office Notepad = kate,vim A more comprehensive list at http://wiki.linuxquestions.org/wiki/ Linux software equivalent to Windows software Ashish Bhatia Introduction to Linux
  • 23. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses What is a user A user represents a real-world entity and it has username (and user ID) Ashish Bhatia Introduction to Linux
  • 24. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses What is a user A user represents a real-world entity and it has username (and user ID) group (and group ID) Ashish Bhatia Introduction to Linux
  • 25. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses What is a user A user represents a real-world entity and it has username (and user ID) group (and group ID) Password Ashish Bhatia Introduction to Linux
  • 26. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses What is a user A user represents a real-world entity and it has username (and user ID) group (and group ID) Password Home Dir Ashish Bhatia Introduction to Linux
  • 27. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses What is a user A user represents a real-world entity and it has username (and user ID) group (and group ID) Password Home Dir Default Shell Ashish Bhatia Introduction to Linux
  • 28. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses What is a user A user represents a real-world entity and it has username (and user ID) group (and group ID) Password Home Dir Default Shell User Details Ashish Bhatia Introduction to Linux
  • 29. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Processes GNU/Linux is a multi-user OS Ashish Bhatia Introduction to Linux
  • 30. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Processes GNU/Linux is a multi-user OS Everything is a file or a process Ashish Bhatia Introduction to Linux
  • 31. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Processes GNU/Linux is a multi-user OS Everything is a file or a process Each process must specify which user is the owner Ashish Bhatia Introduction to Linux
  • 32. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Processes GNU/Linux is a multi-user OS Everything is a file or a process Each process must specify which user is the owner No one except owner has right to access that process* Ashish Bhatia Introduction to Linux
  • 33. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Processes GNU/Linux is a multi-user OS Everything is a file or a process Each process must specify which user is the owner No one except owner has right to access that process* what about files? Ashish Bhatia Introduction to Linux
  • 34. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Files Each file has three (boolean) permissions Read(r) Write(w) Execute(x) Ashish Bhatia Introduction to Linux
  • 35. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Files Each file has three (boolean) permissions Read(r) Write(w) Execute(x) All users can be grouped into Owner(u) Group (members) (g) Others (o) Ashish Bhatia Introduction to Linux
  • 36. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Files Each file has three (boolean) permissions Read(r) Write(w) Execute(x) All users can be grouped into Owner(u) Group (members) (g) Others (o) 9 bits r w x r w x r w x Ashish Bhatia Introduction to Linux
  • 37. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Files Each file has three (boolean) permissions Read(r) Write(w) Execute(x) All users can be grouped into Owner(u) Group (members) (g) Others (o) 9 bits r w x r w x r w x Super-user bypasses file permissions Ashish Bhatia Introduction to Linux
  • 38. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses A few examples chmod 600 file1 Ashish Bhatia Introduction to Linux
  • 39. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses A few examples chmod 600 file1 chmod 400 file2 Ashish Bhatia Introduction to Linux
  • 40. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses A few examples chmod 600 file1 chmod 400 file2 chmod 711 file3 Ashish Bhatia Introduction to Linux
  • 41. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses A few examples chmod 600 file1 chmod 400 file2 chmod 711 file3 chmod 644 file4 Ashish Bhatia Introduction to Linux
  • 42. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses A few examples chmod 600 file1 chmod 400 file2 chmod 711 file3 chmod 644 file4 chmod -R 644 dir1 Ashish Bhatia Introduction to Linux
  • 43. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Files File Permissions on Dir Execute permission is required for a user to cd into a directory Ashish Bhatia Introduction to Linux
  • 44. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Files File Permissions on Dir Execute permission is required for a user to cd into a directory Execute-only permission allows a user to access the files in a directory as long as the user knows the names of the files in the directory(and the user is allowed to read the files) Ashish Bhatia Introduction to Linux
  • 45. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Files File Permissions on Dir Execute permission is required for a user to cd into a directory Execute-only permission allows a user to access the files in a directory as long as the user knows the names of the files in the directory(and the user is allowed to read the files) Execute+Read permission is required to view files contained in dir (eg. ls) Ashish Bhatia Introduction to Linux
  • 46. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Files File Permissions on Dir Execute permission is required for a user to cd into a directory Execute-only permission allows a user to access the files in a directory as long as the user knows the names of the files in the directory(and the user is allowed to read the files) Execute+Read permission is required to view files contained in dir (eg. ls) Execute+Read+Write permission allows the user to create, delete, or modify any files or subdirectories(even if the file or subdirectory is owned by another user) Ashish Bhatia Introduction to Linux
  • 47. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Files Ashish Bhatia Introduction to Linux
  • 48. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Files Something More SetUID(u+s) Ashish Bhatia Introduction to Linux
  • 49. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Files Something More SetUID(u+s) SetGID(g+s) Ashish Bhatia Introduction to Linux
  • 50. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Users and Files Something More SetUID(u+s) SetGID(g+s) Sticky Bit(t) Ashish Bhatia Introduction to Linux
  • 51. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Is Linux (really) secure? Ashish Bhatia Introduction to Linux
  • 52. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Is Linux (really) secure? Security of system or data? 1 Security by design designed for connectivity and security users do not login into admin account (by default) users do not install packages from unverified sources some distros require admin account even for connecting usb Ashish Bhatia Introduction to Linux
  • 53. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Is Linux (really) secure? Security of system or data? 1 Security by design designed for connectivity and security users do not login into admin account (by default) users do not install packages from unverified sources some distros require admin account even for connecting usb 2 intelligent users Ashish Bhatia Introduction to Linux
  • 54. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Is Linux (really) secure? Security of system or data? 1 Security by design designed for connectivity and security users do not login into admin account (by default) users do not install packages from unverified sources some distros require admin account even for connecting usb 2 intelligent users 3 Smaller market to target for attackers Ashish Bhatia Introduction to Linux
  • 55. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Shell provides the traditional user interface for the Unix operating system and for Unix-like systems Ashish Bhatia Introduction to Linux
  • 56. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Shell provides the traditional user interface for the Unix operating system and for Unix-like systems Some popular shells bash ksh csh Unless mentioned all slides assume bash Ashish Bhatia Introduction to Linux
  • 57. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Process in Linux Main Attributes uid - user with whose permissions process executes Ashish Bhatia Introduction to Linux
  • 58. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Process in Linux Main Attributes uid - user with whose permissions process executes pid - process id Ashish Bhatia Introduction to Linux
  • 59. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Process in Linux Main Attributes uid - user with whose permissions process executes pid - process id ppid - parent process id Ashish Bhatia Introduction to Linux
  • 60. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Process in Linux Main Attributes uid - user with whose permissions process executes pid - process id ppid - parent process id terminal - to which process is attached Ashish Bhatia Introduction to Linux
  • 61. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Standard I/O Every process has access to three (standard) files stdin (usually keyboard) - 0 Ashish Bhatia Introduction to Linux
  • 62. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Standard I/O Every process has access to three (standard) files stdin (usually keyboard) - 0 stdout (usually monitor) - 1 Ashish Bhatia Introduction to Linux
  • 63. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Standard I/O Every process has access to three (standard) files stdin (usually keyboard) - 0 stdout (usually monitor) - 1 stderr (usually monitor) - 2 Ashish Bhatia Introduction to Linux
  • 64. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses I/O Redirection Standard I/O of the process can be redirected to other file(s) cmd >filename redirects output from stdout to filename original contents of file are overwritten use >>to append the output to original content Ashish Bhatia Introduction to Linux
  • 65. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses I/O Redirection Standard I/O of the process can be redirected to other file(s) cmd >filename redirects output from stdout to filename original contents of file are overwritten use >>to append the output to original content cmd 2>filename redirects output from stderr to filename original contents of file are overwritten use >>to append the output to original content Ashish Bhatia Introduction to Linux
  • 66. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses I/O Redirection Standard I/O of the process can be redirected to other file(s) cmd >filename redirects output from stdout to filename original contents of file are overwritten use >>to append the output to original content cmd 2>filename redirects output from stderr to filename original contents of file are overwritten use >>to append the output to original content cmd <filename redirects input from stdin to filename Ashish Bhatia Introduction to Linux
  • 67. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses I/O Redirection Standard I/O of the process can be redirected to other file(s) cmd >filename redirects output from stdout to filename original contents of file are overwritten use >>to append the output to original content cmd 2>filename redirects output from stderr to filename original contents of file are overwritten use >>to append the output to original content cmd <filename redirects input from stdin to filename use /dev/null as output file to discard the output Ashish Bhatia Introduction to Linux
  • 68. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(sequentially) What are the possible cases? Ashish Bhatia Introduction to Linux
  • 69. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(sequentially) What are the possible cases? cmd1 ; cmd2 cmd2 is executed after completion of cmd1 Ashish Bhatia Introduction to Linux
  • 70. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(sequentially) What are the possible cases? cmd1 ; cmd2 cmd2 is executed after completion of cmd1 cmd1 && cmd2 cmd2 is executed after successful completion of cmd1 eg. rm abc && mkdir abc creates directory abc only if abc file is deleted successfully Ashish Bhatia Introduction to Linux
  • 71. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(sequentially) What are the possible cases? cmd1 ; cmd2 cmd2 is executed after completion of cmd1 cmd1 && cmd2 cmd2 is executed after successful completion of cmd1 eg. rm abc && mkdir abc creates directory abc only if abc file is deleted successfully cmd1 || cmd2 cmd2 is executed on un-successful completion of cmd1 Ashish Bhatia Introduction to Linux
  • 72. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(sequentially) What are the possible cases? cmd1 ; cmd2 cmd2 is executed after completion of cmd1 cmd1 && cmd2 cmd2 is executed after successful completion of cmd1 eg. rm abc && mkdir abc creates directory abc only if abc file is deleted successfully cmd1 || cmd2 cmd2 is executed on un-successful completion of cmd1 cmd1 | cmd2 cmd2 is executed on successful completion of cmd1 and takes output of cmd1 as its input Ashish Bhatia Introduction to Linux
  • 73. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(in parallel) what is background mode? Ashish Bhatia Introduction to Linux
  • 74. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(in parallel) what is background mode? start process in background mode directly using & at the end of command Ashish Bhatia Introduction to Linux
  • 75. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(in parallel) what is background mode? start process in background mode directly using & at the end of command start process normally (foreground) press ˆz (stops the process) execute bg (to start most recently stopped process in background mode) Ashish Bhatia Introduction to Linux
  • 76. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(in parallel) Handling processes running in background Ashish Bhatia Introduction to Linux
  • 77. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(in parallel) Handling processes running in background jobs - print currently pending (running + stopped) jobs Ashish Bhatia Introduction to Linux
  • 78. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(in parallel) Handling processes running in background jobs - print currently pending (running + stopped) jobs kill %1 - kills job corresponding to number 1 in the jobs output Ashish Bhatia Introduction to Linux
  • 79. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(in parallel) Handling processes running in background jobs - print currently pending (running + stopped) jobs kill %1 - kills job corresponding to number 1 in the jobs output fg - brings a background process back to foreground Ashish Bhatia Introduction to Linux
  • 80. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(in parallel) More process handling Ashish Bhatia Introduction to Linux
  • 81. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(in parallel) More process handling ps [-ely] - see all processes of all users Ashish Bhatia Introduction to Linux
  • 82. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(in parallel) More process handling ps [-ely] - see all processes of all users pstree - shows processes in tree-like (father-child) relation Ashish Bhatia Introduction to Linux
  • 83. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(in parallel) More process handling ps [-ely] - see all processes of all users pstree - shows processes in tree-like (father-child) relation top - show list of running processes interactively q - quit k - kill a process signal -9 kill without warning signal -15 kill after warning (allows cleanup) Ashish Bhatia Introduction to Linux
  • 84. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(in parallel) More process handling ps [-ely] - see all processes of all users pstree - shows processes in tree-like (father-child) relation top - show list of running processes interactively q - quit k - kill a process signal -9 kill without warning signal -15 kill after warning (allows cleanup) kill [signal] process-id kill -9 process-id Ashish Bhatia Introduction to Linux
  • 85. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Executing multiple processes(in parallel) More process handling ps [-ely] - see all processes of all users pstree - shows processes in tree-like (father-child) relation top - show list of running processes interactively q - quit k - kill a process signal -9 kill without warning signal -15 kill after warning (allows cleanup) kill [signal] process-id kill -9 process-id killall [signal] process-cmd-name Ashish Bhatia Introduction to Linux
  • 86. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Free Software As defined by FSF (1986) 1 run the program (for any purpose) Ashish Bhatia Introduction to Linux
  • 87. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Free Software As defined by FSF (1986) 1 run the program (for any purpose) 2 study how the program works (and change it to your needs) Ashish Bhatia Introduction to Linux
  • 88. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Free Software As defined by FSF (1986) 1 run the program (for any purpose) 2 study how the program works (and change it to your needs) 3 redistribute copies Ashish Bhatia Introduction to Linux
  • 89. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Free Software As defined by FSF (1986) 1 run the program (for any purpose) 2 study how the program works (and change it to your needs) 3 redistribute copies 4 improve the program and release your improvements to the public Ashish Bhatia Introduction to Linux
  • 90. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Licenses 1 GNU General Purpose License Disclaimer: I am not a legal expert Ashish Bhatia Introduction to Linux
  • 91. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Licenses 1 GNU General Purpose License 2 GNU Lesser General Purpose License Disclaimer: I am not a legal expert Ashish Bhatia Introduction to Linux
  • 92. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Licenses 1 GNU General Purpose License 2 GNU Lesser General Purpose License 3 Apache License Disclaimer: I am not a legal expert Ashish Bhatia Introduction to Linux
  • 93. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Licenses 1 GNU General Purpose License 2 GNU Lesser General Purpose License 3 Apache License 4 BSD License Disclaimer: I am not a legal expert Ashish Bhatia Introduction to Linux
  • 94. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Licenses 1 GNU General Purpose License 2 GNU Lesser General Purpose License 3 Apache License 4 BSD License 5 lot of others Disclaimer: I am not a legal expert Ashish Bhatia Introduction to Linux
  • 95. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses GNU GPL 1 most popular (and most sophisticated) Ashish Bhatia Introduction to Linux
  • 96. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses GNU GPL 1 most popular (and most sophisticated) 2 a work derived from GPL licensed work must be licensed under GPL Ashish Bhatia Introduction to Linux
  • 97. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses GNU GPL 1 most popular (and most sophisticated) 2 a work derived from GPL licensed work must be licensed under GPL 3 linking to GPL code? Ashish Bhatia Introduction to Linux
  • 98. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses GNU LGPL 1 less restrictive than GPL Ashish Bhatia Introduction to Linux
  • 99. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses GNU LGPL 1 less restrictive than GPL 2 LGPL licensed code can be linked by non-(L)GPL code Ashish Bhatia Introduction to Linux
  • 100. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses GNU LGPL 1 less restrictive than GPL 2 LGPL licensed code can be linked by non-(L)GPL code 3 derivative work must still release code for personal use (of customer) Ashish Bhatia Introduction to Linux
  • 101. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses GNU LGPL 1 less restrictive than GPL 2 LGPL licensed code can be linked by non-(L)GPL code 3 derivative work must still release code for personal use (of customer) 4 LGPL vs GPL? which one to use? Ashish Bhatia Introduction to Linux
  • 102. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses BSD 1 Very permissive Ashish Bhatia Introduction to Linux
  • 103. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses BSD 1 Very permissive 2 just give credits to the previous contributors Ashish Bhatia Introduction to Linux
  • 104. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses BSD 1 Very permissive 2 just give credits to the previous contributors 3 no need to release source-code Ashish Bhatia Introduction to Linux
  • 105. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses BSD 1 Very permissive 2 just give credits to the previous contributors 3 no need to release source-code 4 “If you want to give your software away for free, use BSD. If you want to share your software, use the GPL” (Courtesy:OSnews) Ashish Bhatia Introduction to Linux
  • 106. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Apache 1 Permissiveness same as BSD but legally more explicit Ashish Bhatia Introduction to Linux
  • 107. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Apache 1 Permissiveness same as BSD but legally more explicit 2 handles the problem of software patents Ashish Bhatia Introduction to Linux
  • 108. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Apache 1 Permissiveness same as BSD but legally more explicit 2 handles the problem of software patents 3 author of the code (automatically) gives up the right to any of (his/her) patent used in the code Ashish Bhatia Introduction to Linux
  • 109. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Case 1 ACME systems internally uses CRM whose codebase is based on a GPL based CRM. Can an employee of the company ask for the source code? Ashish Bhatia Introduction to Linux
  • 110. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Case 2 Microspecial Inc. supplies embedded systems to the government, as per the government orders they cannot release the source code to anyone but their codebase is based on GPL based code. What if someone asks for the source code? do they have to give it? Ashish Bhatia Introduction to Linux
  • 111. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Case 3 Stickpoint Solutions released Office software 1.0 under GPL and in the next version, they decide to move to BSD license? can they do it? Ashish Bhatia Introduction to Linux
  • 112. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Case 4 Tivo used parts of Linux kernel code for its consumer electronics product, so they had to release the source code but they put on the hardware check to avoid customised code from execution. Is this a violation of GPL? Ashish Bhatia Introduction to Linux
  • 113. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Case 5 Web Ultimates released source code of CMS(web application) under GPL, Web Peers Inc. used the code to develop their website, do they have to release the source code of their website? Ashish Bhatia Introduction to Linux
  • 114. Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses References 1 Linux Man Pages 2 The Linux Documentation Project 3 Free Software Foundation (FSF) website Ashish Bhatia Introduction to Linux