{"id":1009,"date":"2017-02-27T22:57:42","date_gmt":"2017-02-27T22:57:42","guid":{"rendered":"https:\/\/www.xsofthost.com\/help\/?p=1009"},"modified":"2021-03-21T19:28:57","modified_gmt":"2021-03-21T19:28:57","slug":"linux-and-unix-chmod-command-tutorial-and-examples","status":"publish","type":"post","link":"https:\/\/www.xsofthost.com\/help\/linux-and-unix-chmod-command-tutorial-and-examples\/","title":{"rendered":"chmod command for linux tutorial and Examples"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"1009\" class=\"elementor elementor-1009\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-11bc207 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"11bc207\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-8d8ad9a\" data-id=\"8d8ad9a\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-4226abb elementor-widget elementor-widget-heading\" data-id=\"4226abb\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">What is chmod Linux command<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-161d59b elementor-widget elementor-widget-text-editor\" data-id=\"161d59b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p><strong>chmod command<\/strong> or \u201cchange mode command\u201d, and as that name implies, the chmod command is used to change the mode of Unix\/Linux files.<\/p>\n<p>In other words it is used to define the way a file can be accessed.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-63c919c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"63c919c\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-3135f1d\" data-id=\"3135f1d\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a93741f elementor-widget elementor-widget-heading\" data-id=\"a93741f\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">chmod command Syntax<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-52d3239 elementor-widget elementor-widget-code-highlight\" data-id=\"52d3239\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard word-wrap\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-sass \">\n\t\t\t\t<code readonly=\"true\" class=\"language-sass\">\n\t\t\t\t\t<xmp>chmod options permissions \u201cfilename or directory\u201d\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-7fa05a33 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7fa05a33\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5ec64444\" data-id=\"5ec64444\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-7921b817 elementor-widget elementor-widget-text-editor\" data-id=\"7921b817\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>chmod sections description :<\/p>\n<ul>\n<li><strong>Options<\/strong> :the following table describe the option list\n<table>\n<tbody>\n<tr>\n<th width=\"25%\">Option<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>-f, &#8211;silent, &#8211;quiet<\/td>\n<td>suppress most error messages<\/td>\n<\/tr>\n<tr>\n<td>-v, &#8211;verbose<\/td>\n<td>output a diagnostic for every file processed<\/td>\n<\/tr>\n<tr>\n<td>-c, &#8211;changes<\/td>\n<td>like verbose but report only when a change is made<\/td>\n<\/tr>\n<tr>\n<td>-c, &#8211;reference=RFile<\/td>\n<td>use RFile&#8217;s mode instead of MODE values<\/td>\n<\/tr>\n<tr>\n<td>-R, &#8211;recursive<\/td>\n<td>change files and directories recursively<\/td>\n<\/tr>\n<tr>\n<td>&#8211;help<\/td>\n<td>display help and exit<\/td>\n<\/tr>\n<tr>\n<td>&#8211;version<\/td>\n<td>output version information and exit<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li><strong>Permissions Using Numeric mode<\/strong> :The format of a numeric mode is &#8216;<em>augo<\/em>&#8216; ,A numeric mode is from one to four octal digits (0-7),to set permission you pass the numbers permission to <strong>owner<\/strong> <strong>group\u00a0everyone<\/strong> for example chmod <em>nnn<\/em> is setting permission<strong> n to owner and the second n to group and third n to everyone\u00a0<\/strong>(n is the numeric mode that we will describe bellow) :<br \/>\n<ul>\n<li><strong>4<\/strong> maps for &#8220;<em>read<\/em>&#8220;<\/li>\n<li><strong>2<\/strong> maps for &#8220;<em>write<\/em>&#8220;<\/li>\n<li><strong>1<\/strong> maps for &#8220;<em>execute<\/em>&#8220;<\/li>\n<li><strong>0<\/strong> maps for &#8220;no permission.&#8221;<\/li>\n<li><strong>7<\/strong> is combination of permissions 4+2+1 (<strong>r<\/strong>ead, <strong>w<\/strong>rite, and e<strong>x<\/strong>ecute)<\/li>\n<li><strong>6<\/strong> is combination of permissions 4+2+0 (<strong>r<\/strong>ead, <strong>w<\/strong>rite, and Not execute)<\/li>\n<li><strong>5<\/strong> is 4+0+1 (<strong>r<\/strong>ead, no write, and e<strong>x<\/strong>ecute).<\/li>\n<\/ul>\n<\/li>\n<li><strong>Permissions Using\u00a0symbolic Permissions Notation<\/strong> :The letters <strong>u<\/strong>, <strong>g<\/strong>, and <strong>o<\/strong> mapping to &#8220;<strong>user<\/strong>&#8220;, &#8220;<strong>group<\/strong>&#8220;, and &#8220;<strong>other<\/strong>&#8221; in order.\u00a0and the letters &#8220;<strong>r<\/strong>&#8220;, &#8220;<strong>w<\/strong>&#8220;, and &#8220;<strong>x<\/strong>&#8221; stand for &#8220;<strong>read<\/strong>&#8220;, &#8220;<strong>write<\/strong>&#8220;, and &#8220;<strong>execute<\/strong>&#8220;, respectively.and you will need to use The equals sign (=) between the u,g,o and rwx as example: <div class=\"well   oscitas-bootstrap-container \">chmod u=rwx,g=rx,o=w example.txt<\/div> This is means apply read write and execute permissions to owner, and assign read and execute to group , and assign write permission to other.<\/li>\n<\/ul>\n<div class=\"cmd\">\n<div class=\"text-orange\">owner ,No permissions to group and everyone example3.txt<\/div>\n<\/div>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-49c473b elementor-widget elementor-widget-code-highlight\" data-id=\"49c473b\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard word-wrap\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash \">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>chmod u=rwx example3.txt\n#-rwx\u2014\u2014\n\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-c8cd795 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"c8cd795\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-27ebeb8\" data-id=\"27ebeb8\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-7076cf3 elementor-widget elementor-widget-heading\" data-id=\"7076cf3\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">chmod Examples:\n<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-004e56a elementor-widget elementor-widget-heading\" data-id=\"004e56a\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">chmod Examples Permissions Using Numeric mode :\n<\/h3>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-abe27bb elementor-widget elementor-widget-text-editor\" data-id=\"abe27bb\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tSetting Read\/Write\/execute to owner Read\/execute to group and everyone else to example1.txt\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3a17621 elementor-widget elementor-widget-code-highlight\" data-id=\"3a17621\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard word-wrap\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash \">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>chmod 755 example1.txt\n#-rxwr-xr-x\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1663786 elementor-widget elementor-widget-text-editor\" data-id=\"1663786\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tSetting Read\/Write to owner Read\/execute to group and read only to everyone else to example2.txt\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e42fbc2 elementor-widget elementor-widget-code-highlight\" data-id=\"e42fbc2\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard word-wrap\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash \">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>chmod 664 example2.txt\n#-rw-rw-r\u2013\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b770429 elementor-widget elementor-widget-text-editor\" data-id=\"b770429\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tSetting Read\/Write\/execute to owner ,No permissions to group and everyone example3.txt\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5677b3a elementor-widget elementor-widget-code-highlight\" data-id=\"5677b3a\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard word-wrap\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash \">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>chmod 700 example3.txt\n#-rwx\u2014\u2014\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8b08638 elementor-widget elementor-widget-heading\" data-id=\"8b08638\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">chmod Examples Permissions Using symbolic Permissions Notation :\n<\/h3>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8846339 elementor-widget elementor-widget-text-editor\" data-id=\"8846339\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tSetting Read\/Write\/execute to owner Read\/execute to group and everyone else to example1.txt\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-795c213 elementor-widget elementor-widget-code-highlight\" data-id=\"795c213\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard word-wrap\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash \">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>chmod u=rwx,g=rx,o=rx example1.txt\n#-rxwr-xr-x\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ad2cf24 elementor-widget elementor-widget-text-editor\" data-id=\"ad2cf24\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tSetting Read\/Write to owner Read\/execute to group and read only to everyone else to example2.txt\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-83c82f8 elementor-widget elementor-widget-code-highlight\" data-id=\"83c82f8\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard word-wrap\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash \">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>chmod u=rw,g=rx,o=r example2.txt\n#-rw-rw-r\u2013\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-212bcbd elementor-widget elementor-widget-text-editor\" data-id=\"212bcbd\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\tSetting Read\/Write\/execute to owner ,No permissions to group and everyone example3.txt\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2bde864 elementor-widget elementor-widget-code-highlight\" data-id=\"2bde864\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard word-wrap\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-bash \">\n\t\t\t\t<code readonly=\"true\" class=\"language-bash\">\n\t\t\t\t\t<xmp>chmod u=rwx example3.txt\n#-rwx\u2014\u2014\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>What is chmod Linux command chmod command or \u201cchange mode command\u201d, 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 \u201cfilename or directory\u201d chmod sections description [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":859,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[41],"tags":[158,42,50,149],"_links":{"self":[{"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/posts\/1009"}],"collection":[{"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/comments?post=1009"}],"version-history":[{"count":58,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/posts\/1009\/revisions"}],"predecessor-version":[{"id":3749,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/posts\/1009\/revisions\/3749"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/media\/859"}],"wp:attachment":[{"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/media?parent=1009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/categories?post=1009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/tags?post=1009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}