
{"id":4681,"date":"2021-09-04T11:08:39","date_gmt":"2021-09-04T11:08:39","guid":{"rendered":"http:\/\/ubuntuhandbook.org\/?p=4681"},"modified":"2021-09-04T11:10:22","modified_gmt":"2021-09-04T11:10:22","slug":"open-as-root-elementary-os-freya","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2021\/09\/open-as-root-elementary-os-freya\/","title":{"rendered":"Add &#8216;Open File\/Folder as Root \/ Administrator&#8217; in Elementary OS 6 [Update 2021]"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/elementaryos-logo1200.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/elementaryos-logo250.png\" alt=\"\" width=\"250\" height=\"250\" class=\"alignleft size-thumbnail wp-image-34526\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/elementaryos-logo250.png 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/elementaryos-logo250-150x150.png 150w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p><b>This is a step by step tutorial shows how to add &#8220;open as root (or administrator)&#8221; option in Pantheon file browser in Elementary OS 6 Odin.<\/b><\/p>\n<p>Elementary OS now is at version 6.0 based on Ubuntu 20.04 LTS. For those looking for the &#8220;Open as Administrator&#8221; function to open system file via root user permission, or do copy &#038; paste things outside of user&#8217;s home directory, things have changed.<\/p>\n<p>The executable command for the file manager now is <code>io.elementary.files<\/code>, and the command to start text editor is <code>io.elementary.code<\/code>. Both are named in Flatpak app style. Gksu has gnone, and &#8220;pkexec&#8221; takes the place to allow an authorized user to execute program as root. <\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/editasadmin-option.jpeg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/editasadmin-option-600x374.jpeg\" alt=\"\" width=\"600\" height=\"374\" class=\"aligncenter size-large wp-image-34531\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/editasadmin-option-600x374.jpeg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/editasadmin-option-300x187.jpeg 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/editasadmin-option-768x479.jpeg 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/editasadmin-option.jpeg 995w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<h3>Add Open as Admin action in Elementary OS 6:<\/h3>\n<p><b>1. )<\/b> Firstly, search for and open &#8220;terminal&#8221; from the top-left corner Applications menu.<\/p>\n<p><b>2.<\/b> When terminal opens, run command to create (&#038; edit via nano) the configuration file for option to edit file as root user privilege:<\/p>\n<pre>sudo nano \/usr\/share\/contractor\/io.elementary.code.open-as-root.contract<\/pre>\n<p>When the file opens in terminal, paste following lines and save via <b>Ctrl+X<\/b>, type <b>y<\/b> and hit Enter.<\/p>\n<blockquote><p>[Contractor Entry]<br \/>\nName=Edit as Administrator<br \/>\nIcon=io.elementary.code<br \/>\nDescription=Edit file via root user privilege<br \/>\nMimeType=text\/plain;<br \/>\nExec=pkexec io.elementary.code %U<br \/>\nGettext-Domain=code<\/p><\/blockquote>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/editfileasroot.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/editfileasroot.png\" alt=\"\" width=\"600\" height=\"412\" class=\"aligncenter size-full wp-image-34529\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/editfileasroot.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/editfileasroot-300x206.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p><b>3.<\/b> And create another config file for an option to open folder as root permission:<\/p>\n<pre>sudo nano \/usr\/share\/contractor\/io.elementary.files.open-as-root.contract<\/pre>\n<p>Then paste the following lines and save it (Ctrl+X, type y, and hit Enter):<\/p>\n<blockquote><p>[Contractor Entry]<br \/>\nName=Open as Administrator<br \/>\nIcon=system-file-manager<br \/>\nDescription=Open a folder via root user privilege<br \/>\nMimeType=inode\/directory;<br \/>\nExec=pkexec io.elementary.files %U<br \/>\nGettext-Domain=file manager<\/p><\/blockquote>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/openfolderasroot.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/openfolderasroot.png\" alt=\"\" width=\"600\" height=\"411\" class=\"aligncenter size-full wp-image-34530\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/openfolderasroot.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2015\/02\/openfolderasroot-300x206.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>After creating the two files, &#8220;Edit as Administrator&#8221; and &#8220;Open as Administrator&#8221; context menu option appear when right-clicking a file or folder immediately without restart.<\/p>\n<p>As you see, you can create more actions by creating files with &#8220;.contract&#8221; extension under <b>\/usr\/share\/contractor<\/b> directory. The name will be displayed as menu option, and you can find value of icon, MineType and Exec by checking the app shortcut file (<code>.desktop<\/code>) under \/usr\/share\/applications directory.<\/p>\n<p>That&#8217;s all. Enjoy!<\/p>","protected":false},"excerpt":{"rendered":"<p>This is a step by step tutorial shows how to add &#8220;open as root (or administrator)&#8221; option in Pantheon file browser in Elementary OS 6 Odin. Elementary OS now is at version 6.0 based on Ubuntu 20.04 LTS. For those looking for the &#8220;Open as Administrator&#8221; function to open system file via root user permission, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":34528,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[781,671],"class_list":["post-4681","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-elementary-os","tag-open-as-root"],"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/4681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=4681"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/4681\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/34528"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=4681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=4681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=4681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}