{"id":1032,"date":"2017-02-28T12:18:09","date_gmt":"2017-02-28T12:18:09","guid":{"rendered":"https:\/\/www.xsofthost.com\/help\/?p=1032"},"modified":"2021-03-21T19:12:50","modified_gmt":"2021-03-21T19:12:50","slug":"linux-unix-chown-command-change-owner-help-and-examples","status":"publish","type":"post","link":"https:\/\/www.xsofthost.com\/help\/linux-unix-chown-command-change-owner-help-and-examples\/","title":{"rendered":"chown command Linux to Change owner with examples"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"1032\" class=\"elementor elementor-1032\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-e8b7e63 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e8b7e63\" 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-2f867e3\" data-id=\"2f867e3\" 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-02589cc elementor-widget elementor-widget-text-editor\" data-id=\"02589cc\" 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><b>chown Command linux<\/b> is an administrator command is used to change the owner user and\/or group of each given file or directory.<\/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-444be0a elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"444be0a\" 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-88d8fd0\" data-id=\"88d8fd0\" 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-a9b870c elementor-widget elementor-widget-heading\" data-id=\"a9b870c\" 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\">chown Command syntax<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1c250a7 elementor-widget elementor-widget-code-highlight\" data-id=\"1c250a7\" 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>chown [options] newowner directoryname\/filename\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-8c6e322 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8c6e322\" 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-a4cc286\" data-id=\"a4cc286\" 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-e3a31d9 elementor-widget elementor-widget-heading\" data-id=\"e3a31d9\" 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\">chown options<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-205aea7b elementor-widget elementor-widget-text-editor\" data-id=\"205aea7b\" 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<ul>\n\t<li><strong>-c, &#8211;changes<\/strong> : like verbose but report only when a change is made.<\/li>\n\t<li><strong>&#8211;reference=RFILE<\/strong> :use RFILE&#8217;s owner and group rather than specifying OWNER:GROUP values<\/li>\n\t<li><strong>-f, &#8211;silent, &#8211;quiet<\/strong>:suppress most error messages.<\/li>\n\t<li><strong>&#8211;dereference<\/strong> : affect the referenced file of each symbolic link rather than the symbolic link itself. This is the default.<\/li>\n\t<li><strong>-v, &#8211;verbose<\/strong> :output a diagnostic for every file processed.<\/li>\n\t<li><strong>&#8211;from=CURRENT_OWNER:CURRENT_GROUP<\/strong>:change the owner and\/or group of each file only if its current owner and\/or group match those specified here. Either may be omitted, in which case a match is not required for the omitted attribute.<\/li>\n\t<li><strong>-h, &#8211;no-dereference<\/strong>:affect symbolic links instead of any referenced file. This is useful only on systems that can change the ownership of a symlink.<\/li>\n\t<li><strong>&#8211;preserve-roo<\/strong>t:Do not operate recursively on &#8216;\/&#8217;.<\/li>\n\t<li><strong>&#8211;no-preserve-root<\/strong>:do not treat &#8216;\/&#8217; (the root directory) in any special way. This is the default.<\/li>\n\t<li><strong>-R, &#8211;recursive<\/strong>:operate on files and directories recursively.<\/li>\n\t<li><strong>-L<\/strong> :traverse every symbolic link to a directory encountered.<\/li>\n\t<li><strong>-H<\/strong> :if a command line argument is a symbolic link to a directory, traverse it.<\/li>\n\t<li><strong>-P<\/strong> :do not traverse any symbolic links. This is the default.<\/li>\n\t<li><strong>&#8211;help<\/strong> :display this help and exit.<\/li>\n\t<li><strong>&#8211;version<\/strong> :output version information and exit.<\/li>\n<\/ul>\n\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-1fdb001 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"1fdb001\" 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-a76b853\" data-id=\"a76b853\" 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-7371b19 elementor-widget elementor-widget-heading\" data-id=\"7371b19\" 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\">chown Command Examples\n<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7be56b5 elementor-widget elementor-widget-heading\" data-id=\"7be56b5\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\">Changing owner for directories recursively<\/h4>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fc7cc9e elementor-widget elementor-widget-text-editor\" data-id=\"fc7cc9e\" 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\tThe ownership of the directories and files contained in them can be changed recursively with -R option.\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-5537571 elementor-widget elementor-widget-code-highlight\" data-id=\"5537571\" 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>chown -R exaccount \/home\/example\/<\/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-57f6d56 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"57f6d56\" 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-6ad09dd\" data-id=\"6ad09dd\" 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-f6ba70d elementor-widget elementor-widget-heading\" data-id=\"f6ba70d\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\">chown Verbose output<\/h4>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e6e05fc elementor-widget elementor-widget-text-editor\" data-id=\"e6e05fc\" 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>The \u2013verbose option shows all the ownership changing. It outputs the diagnostics for each file processed<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e6baa3e elementor-widget elementor-widget-code-highlight\" data-id=\"e6baa3e\" 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>chown -R \u2013verbose david \/home\/david\/\n#changed ownership of \u2018\/home\/david\/emails\u2019 to david\n#changed ownership of \u2018\/home\/david\/blogs\u2019 to david\n#changed ownership of \u2018\/home\/david\/plugins\u2019 to david<\/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-a8246a2 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a8246a2\" 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-acde49c\" data-id=\"acde49c\" 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-a42e8b4 elementor-widget elementor-widget-heading\" data-id=\"a42e8b4\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\">Preserve root<\/h4>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d2c18fb elementor-widget elementor-widget-text-editor\" data-id=\"d2c18fb\" 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\tTo prevent changing the ownership of \/ directory recursively, \u2013preserve-root is used.\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-47f4c06 elementor-widget elementor-widget-code-highlight\" data-id=\"47f4c06\" 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>chown -R \u2013preserve-root david \/\n#chown: changing ownership of \u2018\/proc\/1\/tasks\/1\/fd\u2019: Permission denied\n#chown: changing ownership of \u2018\/proc\/1\/tasks\/1\/fd\/status\u2019: Permission denied\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-80fc1f3 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"80fc1f3\" 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-26ae7c8\" data-id=\"26ae7c8\" 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-736a91a elementor-widget elementor-widget-heading\" data-id=\"736a91a\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\">chown Silent operation\n<\/h4>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b958a7d elementor-widget elementor-widget-text-editor\" data-id=\"b958a7d\" 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>Let&#8217;s consider the following scenario .As normal users cannot change the ownership of files owned by others. Then an error is displayed when a that user tries to change the ownership.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0d07578 elementor-widget elementor-widget-code-highlight\" data-id=\"0d07578\" 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>chown david \/etc\/\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-abda477 elementor-widget elementor-widget-text-editor\" data-id=\"abda477\" 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\tchown: changing ownership of `\/etc\/\u2019: Operation not permitted\nBut if by passing -f or \u2013silent or \u2013quiet option, the error is not displayed.\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9aa3bcb elementor-widget elementor-widget-code-highlight\" data-id=\"9aa3bcb\" 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>chown -f david \/etc\/<\/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>chown Command linux is an administrator command is used to change the owner user and\/or group of each given file or directory. chown Command syntax chown [options] newowner directoryname\/filename chown options -c, &#8211;changes : like verbose but report only when a change is made. &#8211;reference=RFILE :use RFILE&#8217;s owner and group rather than specifying OWNER:GROUP values [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":354,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[41],"tags":[178,42,50,149,74],"_links":{"self":[{"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/posts\/1032"}],"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=1032"}],"version-history":[{"count":87,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/posts\/1032\/revisions"}],"predecessor-version":[{"id":3712,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/posts\/1032\/revisions\/3712"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/media\/354"}],"wp:attachment":[{"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/media?parent=1032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/categories?post=1032"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/tags?post=1032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}