{"id":9705,"date":"2013-04-01T21:48:54","date_gmt":"2013-04-02T02:48:54","guid":{"rendered":"http:\/\/bucktownbell.com\/?p=9705"},"modified":"2014-02-16T23:44:59","modified_gmt":"2014-02-17T05:44:59","slug":"permission-denied-for-file-write","status":"publish","type":"post","link":"http:\/\/bucktownbell.com\/?p=9705","title":{"rendered":"permission denied for file write"},"content":{"rendered":"<blockquote><p>Redirections such as <code>&gt;<\/code> or <code>|<\/code> are performed by the running shell, <em>before<\/em> it invokes <code>sudo<\/code>.<\/p>\n<p>You have to either use<\/p>\n<p><code>sudo sh -c \"echo blah &gt; \/proc\/blah\"<\/code>, or run a root shell with <code>sudo -s<\/code>.<\/p><\/blockquote>\n<p>via <a href=\"http:\/\/superuser.com\/questions\/480998\/bash-permission-denied-for-file-write\">linux &#8211; Bash: permission denied for file write &#8211; Super User<\/a>.<\/p>\n<p>This had me stumped until the greatness of google divined the answer and why my user script couldn&#8217;t write to a root owned file using plain old sudo.\u00a0 After figuring this out I also realized I don&#8217;t need to write to a root owned file after all but I found this solution interesting.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Redirections such as &gt; or | are performed by the running shell, before it invokes sudo. You have to either use sudo sh -c &#8220;echo blah &gt; \/proc\/blah&#8221;, or run a root shell with sudo -s. via linux &#8211; Bash: &hellip; <a href=\"http:\/\/bucktownbell.com\/?p=9705\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[721,28,72],"class_list":["post-9705","post","type-post","status-publish","format-standard","hentry","category-programming","tag-linux-admin","tag-linux-command","tag-problem-solved"],"_links":{"self":[{"href":"http:\/\/bucktownbell.com\/index.php?rest_route=\/wp\/v2\/posts\/9705","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bucktownbell.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bucktownbell.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bucktownbell.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bucktownbell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9705"}],"version-history":[{"count":4,"href":"http:\/\/bucktownbell.com\/index.php?rest_route=\/wp\/v2\/posts\/9705\/revisions"}],"predecessor-version":[{"id":12561,"href":"http:\/\/bucktownbell.com\/index.php?rest_route=\/wp\/v2\/posts\/9705\/revisions\/12561"}],"wp:attachment":[{"href":"http:\/\/bucktownbell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bucktownbell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9705"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bucktownbell.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}