Files & Permissions - Ch2 Flashcards
FHS
File Hierarchy System ;
Specifies directory structure, type of info to store, & how shared
Static directory
Holds static data & contains user and administrative commands, help files, library files, kernel and boot files;
/usr
/boot
/opt
Dynamic directory
Holds variable data containing log and spool files, config files, temp files, personal user files /var /etc /tmp /home
Static and shareable directories
/opt
/usr
Static and unshareable
/boot
/etc
Variable and shareable
/var/mail
/var/opt
Variable and unshareable
/var/lock
/run
/etc
holds sys config files
/root
Default home dir of root user
/media
To auto mount removable media
/mnt
To temp mount a file system
/bin and /usr/bin
To store admin commands
/lib, /usr/lib, /lib64, /usr/lib64
To store 32 and 64 bit library routines needed by various commands and programs
touch
Creates empty file and sets timestamp
cat
Create short text file;
ex: cat > catfile1 then enter text;
Press Ctrl+d to save and return to shell prompt
vi
Create and modify text files
mkdir
Make directory
ls
List directories
ll
List details;
short for ls -l
File / directory column information
Col 1: First char indicates file “-“ or dir “d”, remaining 9 char indicate permissions
Col 2: No of links
Col 3: Owner name
Col 4: Owning group
Col 5: Size in bytes (files) or blocks (dir)
Col 6,7,8: Mo, day and time of last modification
Col 9: Name of file or dir
less
Text filter for viewing long text files, forward and backward, before entire file is loaded;
more
Text filter for viewing long text files forward only
cp
Copy files and directories
mv
Move files and directories
rm
Remove files and directories
Regular files
May contain text or binary;
Files depicted by hyphen “-“ when listed
Directory files
Logical containers used to hold files and sub directories
Executable files
Files that can be run;
Commands in binary format or shell scripts
Symbolic link file
Shortcut to another file or directory
Device file
File associated with system hardware used by kernel to communicate with hardware
Permission classes
User
Group
Other (public)
Permission types
r read
w write
x execute
Permission modes
+ add
- revoke
= assign
Octal permission notation
3 digit num sys (0-7) to express permissions for 3 user classes
Octal permission weights
Weights assoc with each digit permission
X X X
| | |
4 2 1
ex. .. permission 2 would reference the middle digit
ex. .. permission 6 would reference 2 most left digits
chmod
Change permissions
Symbolic permissions notation
x Execute
r Read
w Write
ex… Add execute permiss bit for owner
chmod u+x file1 -v
ex… Add write permiss for group members and public
chmod go+w file1 -v
umask
User mask;
3 digit octal value referencing r/w/e values for owner group and public
Default permissions
Initial permissions (666) - umask
chown
Change ownereship
chgrp
Change group
useradd
Create user account
Metadata
Attributes associated with files… data about data
inode
Index node;
storage space where metadata is stored
Hard link
Mapping between one or more filenames and an inode
ln
Command to create a hard link
Soft link
Symbolic link which allows associations between files;
Shortcut associations with files;
Each softlink has a unique inode #
ln -s
Command to create a soft link
find
Searches for files that match specified criteria
Period “.”
Represents the current dir
ex… find . -nam e newfile1
Search for file “find” in the current directory
Tilda ~
Represents current user home dir
locate
Discover all occurrences of specified string in file pathnames
which
Prints path to command executed when run
whereis
Prints path to command executed when run, including path to command’s man pages
type
Prints path to command executed when run
setuid
Set user identifier;
provide non owners or groups ability to run executables with owner priveledges
setgid
Set user identifier;
provide non owners or groups ability to run executables with owner priveledges;
Can be applied to shared dir also
sticky bit
Applied to public directories for inhibiting file erasures by non-owners.