Tutorial: How to Assign and Use File Permissions on UNIX and Linux

Опубликовано: 14 Октябрь 2024
на канале: The Expat Professor
1,657
15

Lab 05 Linux and UNIX Permissions
(c) Paul W. Poteete 2016

The Basics:
3 Objects: ugo(a)
3 Rights: rwx

2 things that you need to know:
Who owns the file or directory?
What are the permissions for the owner and group?

Symbolic versus Numeric Syntax
Symbolic Syntax uses familiar symbols to represent each object and right.
Generally used to alter permissions during administration.

Numeric Syntax uses numbers to assign rights.
Generally used to assign permissions immediately after creation.

Notes:
Directories need the x right assigned in order for the object to traverse (change into) it.
Scripts and Binary files should have the x right assigned to allow execution.
Executing a script or binary from within the current directory context must be prefixed with './'

Commands:
mkdir
cd
touch
echo
chown
chmod

Examples:

= File
-rwxrwxr-x 1 ppoteete ppoteete 174 Mar 13 08:12 /tmp/install.sh

d = Directory
drwxrwxrwt 14 root root 52K Mar 13 08:24 tmp

Permissions:
User Group Other
rwx rwx rwx
421 421 421

777
ugo rwx rwx rwx

755
rwx r-x r-x

chmod u+rw file.txt
chmod u=w file.txt
chmod u-w file.txt
chmod ugo+rw file.txt

chmod 666 file.txt
chmod 664 file.txt

chown student file.txt
chown student.student file.txt
chgrp student file.txt
chown .student file.txt

Please join me:
   / paulwpoteete  
  / paulwpoteete  
  / paulwpoteete  
  / paulwpoteete  
https://plus.google.com/+PaulWPoteete
  / paulwpoteete  

Thank you for visiting,
Paul


#linux, #unix, #tutorial, #administration, #engineering, #beginner, #expert, #advanced, #intermediate, #training