{"id":3226,"date":"2014-04-24T13:12:33","date_gmt":"2014-04-24T13:12:33","guid":{"rendered":"http:\/\/ubuntuhandbook.org\/?p=3226"},"modified":"2018-02-15T13:02:26","modified_gmt":"2018-02-15T13:02:26","slug":"ubuntu-14-04-add-open-as-rootadministrator-to-context-menu","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2014\/04\/ubuntu-14-04-add-open-as-rootadministrator-to-context-menu\/","title":{"rendered":"Ubuntu 14.04: Add &#8216;Open As Root\/Administrator&#8217; to Context Menu"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/03\/ubuntu-logo-32.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/03\/ubuntu-logo-32.png\" alt=\"ubuntu 14.04 context menu\" width=\"200\" height=\"200\" class=\"aligncenter size-full wp-image-3081\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/03\/ubuntu-logo-32.png 200w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/03\/ubuntu-logo-32-150x150.png 150w\" sizes=\"auto, (max-width: 200px) 100vw, 200px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>This simple tutorial will show you how to add &#8216;Open As Root&#8217; or &#8216;Open As Administrator&#8217; option to context menu so that you can easily edit \/ open file folders as super user privilege within Nautilus file browser.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/OpenAsAdministrator-ubuntu13-04.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/OpenAsAdministrator-ubuntu13-04.jpg\" alt=\"Open as Administrator ubuntu 14.04\" width=\"580\" height=\"270\" class=\"aligncenter size-full wp-image-1844\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/OpenAsAdministrator-ubuntu13-04.jpg 580w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/OpenAsAdministrator-ubuntu13-04-300x139.jpg 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<div class=\"arconix-box arconix-box-yellow\"><i class='fa fa-2x pull-left fa-lightbulb-o'><\/i><div class=\"arconix-box-content\">There&#8217;s now a <a href=\"https:\/\/ubuntuhandbook.org\/index.php\/2018\/02\/open-as-admin-nautilus-file-browser\/\" target=\"_blank\">Nautilus extension (see the link)<\/a> adds administrative actions to Nautilus context menu. It&#8217;s easy to install and supports for all current Ubuntu releases.<\/div><\/div>\n<p><b>To get started:<\/b><\/p>\n<p>1. Open Ubuntu Software Center. Search for and make sure the package <b>gksu<\/b> is installed. <b>gksu<\/b> allows graphical programs to ask a user\u2019s password to run program as root \/ administrator.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/04\/install-gksu-ubuntu1404.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/04\/install-gksu-ubuntu1404.png\" alt=\"gksu ubuntu 14.04\" width=\"560\" height=\"199\" class=\"aligncenter size-full wp-image-3227\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/04\/install-gksu-ubuntu1404.png 560w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/04\/install-gksu-ubuntu1404-300x106.png 300w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><\/p>\n<p>2. Open Nautilus file browser, press Ctrl+H to view hidden files &#038; folders. Navigate to <b>USER Home -> .local -> share -> nautilus -> scripts<\/b>.<\/p>\n<p>Create an empty document under this directory named &#8216;open-as-administrator&#8217; or &#8216;open-as-root&#8217;<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/create-open-as-administrator.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/create-open-as-administrator.jpg\" alt=\"open as administtrator ubuntu 14.04\" width=\"580\" height=\"257\" class=\"aligncenter size-full wp-image-1845\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/create-open-as-administrator.jpg 580w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/create-open-as-administrator-300x132.jpg 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p>3. Edit and paste following lines into the file<\/p>\n<p><code>#!\/bin\/bash<br \/>\n#<br \/>\n# this code will determine exactly the path and the type of object,<br \/>\n# then it will decide use gedit or nautilus to open it by ROOT permission<br \/>\n#<br \/>\n# Determine the path<br \/>\nif [ -e -n $1 ]; then<br \/>\nobj=\"$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS\"<br \/>\nelse<br \/>\nbase=\"`echo $NAUTILUS_SCRIPT_CURRENT_URI | cut -d'\/' -f3- | sed 's\/%20\/ \/g'`\"<br \/>\nobj=\"$base\/${1##*\/}\"<br \/>\nfi<br \/>\n# Determine the type and run as ROOT<br \/>\nif [ -f \"$obj\" ]; then<br \/>\ngksu gedit \"$obj\"<br \/>\nelif [ -d \"$obj\" ]; then<br \/>\ngksu nautilus \"$obj\"<br \/>\nfi<\/p>\n<p>exit 0<\/code><\/p>\n<p>4. Press <b>Ctrl+Alt+T<\/b> to open the terminal. When it opens, run the command below to make executable:<\/p>\n<pre style=\"border:none;\">cd .local\/share\/nautilus\/scripts\/ && chmod 0755 open-as-administrator<\/pre>\n<p>5. Finally restart Nautilus via command <code>nautilus -q<\/code>, or just log out and back in.<\/p>","protected":false},"excerpt":{"rendered":"<p>&nbsp; This simple tutorial will show you how to add &#8216;Open As Root&#8217; or &#8216;Open As Administrator&#8217; option to context menu so that you can easily edit \/ open file folders as super user privilege within Nautilus file browser. To get started: 1. Open Ubuntu Software Center. Search for and make sure the package gksu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[670,671,855],"class_list":["post-3226","post","type-post","status-publish","format-standard","hentry","category-howtos","tag-open-as-administrator","tag-open-as-root","tag-ubuntu-14-04"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/3226","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=3226"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/3226\/revisions"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=3226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=3226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=3226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}