Warning: session_start(): open(/var/cpanel/php/sessions/alt-php74/sess_2de95f306c38f002d477400ddee5d98d, O_RDWR) failed: No such file or directory (2) in /home/xsofthost/public_html/help/wp-content/plugins/accelerated-mobile-pages/includes/redirect.php on line 358

Warning: session_start(): Failed to read session data: files (path: /var/cpanel/php/sessions/alt-php74) in /home/xsofthost/public_html/help/wp-content/plugins/accelerated-mobile-pages/includes/redirect.php on line 358
Chmod Command Linux Tutorial Syntax And Examples how. to use Chmod

chmod command for linux tutorial and Examples

What is chmod Linux command

chmod command or “change mode command”, and as that name implies, the chmod command is used to change the mode of Unix/Linux files.

In other words it is used to define the way a file can be accessed.

chmod command Syntax

				
					chmod options permissions “filename or directory”

				
			

chmod sections description :

  • Options :the following table describe the option list
    OptionDescription
    -f, –silent, –quietsuppress most error messages
    -v, –verboseoutput a diagnostic for every file processed
    -c, –changeslike verbose but report only when a change is made
    -c, –reference=RFileuse RFile’s mode instead of MODE values
    -R, –recursivechange files and directories recursively
    –helpdisplay help and exit
    –versionoutput version information and exit
  • Permissions Using Numeric mode :The format of a numeric mode is ‘augo‘ ,A numeric mode is from one to four octal digits (0-7),to set permission you pass the numbers permission to owner group everyone for example chmod nnn is setting permission n to owner and the second n to group and third n to everyone (n is the numeric mode that we will describe bellow) :
    • 4 maps for “read
    • 2 maps for “write
    • 1 maps for “execute
    • 0 maps for “no permission.”
    • 7 is combination of permissions 4+2+1 (read, write, and execute)
    • 6 is combination of permissions 4+2+0 (read, write, and Not execute)
    • 5 is 4+0+1 (read, no write, and execute).
  • Permissions Using symbolic Permissions Notation :The letters u, g, and o mapping to “user“, “group“, and “other” in order. and the letters “r“, “w“, and “x” stand for “read“, “write“, and “execute“, respectively.and you will need to use The equals sign (=) between the u,g,o and rwx as example:
    chmod u=rwx,g=rx,o=w example.txt
    This is means apply read write and execute permissions to owner, and assign read and execute to group , and assign write permission to other.
owner ,No permissions to group and everyone example3.txt
				
					chmod u=rwx example3.txt
#-rwx——


				
			

chmod Examples:

chmod Examples Permissions Using Numeric mode :

Setting Read/Write/execute to owner Read/execute to group and everyone else to example1.txt
				
					chmod 755 example1.txt
#-rxwr-xr-x

				
			
Setting Read/Write to owner Read/execute to group and read only to everyone else to example2.txt
				
					chmod 664 example2.txt
#-rw-rw-r–

				
			
Setting Read/Write/execute to owner ,No permissions to group and everyone example3.txt
				
					chmod 700 example3.txt
#-rwx——

				
			

chmod Examples Permissions Using symbolic Permissions Notation :

Setting Read/Write/execute to owner Read/execute to group and everyone else to example1.txt
				
					chmod u=rwx,g=rx,o=rx example1.txt
#-rxwr-xr-x

				
			
Setting Read/Write to owner Read/execute to group and read only to everyone else to example2.txt
				
					chmod u=rw,g=rx,o=r example2.txt
#-rw-rw-r–

				
			
Setting Read/Write/execute to owner ,No permissions to group and everyone example3.txt
				
					chmod u=rwx example3.txt
#-rwx——

				
			
Share on facebook
Share on twitter
Share on linkedin
Share on telegram
Share on whatsapp

Related Posts