elementary OS User Handbook
eOS HomeTeamBlogSupportGet Involved
  • 🔵Welcome to elementary OS
  • Overview
    • 📘Idea & Evolution
    • 📘Desktop Tour
      • 📖Greeter
      • 📖Panel
      • 📖Dock
      • 📖App Windows
      • 📖Multitasking
    • 📘System Idiosyncrasies
      • 📖Gestures
      • 📖Hot Corners
      • 📖Picture-in-Picture
      • 📖Display Filters
      • 📖Feedback App
      • 📖Missing Habits
  • Get Started
    • 📗Install elementary OS
      • 📖Writing ISO with Etcher
      • 📖Using GParted
    • 📗Explore System Settings
      • 📖Manage User Accounts
      • 📖Control System Access
      • 📖Set up Date & Time
      • 📖Configure Network
      • 📖Add Online Accounts
      • 📖Stay Secure & Private
      • 📖Adjust Power Settings
      • 📖Set Language & Formats
      • 📖Keyboard Settings
      • 📖Mouse & Touchpad
    • 📗Customize Desktop
      • 📖Set up Visual Style
      • 📖Change Wallpaper
      • 📖Adjust Text Size
      • 📖Configure Dock & Panel
      • 📖Windows and Corners
    • 📗Plug in Hardware
      • 📖Connect via Bluetooth
      • 📖Printers & Scanners
      • 📖Hook up Tablet
  • Best Practices
    • 📙Tips & Tricks
      • 📖Add PPAs
      • 📖Get More Tweaks
      • 📖Max the AppCenter Out
      • 📖Add More Fonts
      • 📖Make QT apps look like GTK
    • 📙2 Advanced
      • 📖Open as Admin
      • 📖Create Local Network
      • 📖Plank Advanced Customization
  • Troubleshooting
    • 📕Installation Issues
    • 📕Common Issues
      • 📖Grub menu 30 sec
      • 📖Nvidia Drivers
      • 📖Double Icons in Plank
      • 📖Sound and Picture Issues
      • 📖Ghost Updates
  • Extra Info
    • 📒Useful Links
    • 📒Feedback
Powered by GitBook
On this page
  1. Best Practices
  2. 2 Advanced

Open as Admin

There are cases when you may need to open and edit a file as administrator (as a rule, when you need to edit configuration files in your root directory.

Be extremely careful when changing /root files. Unthoughtful actions can break your system.

Always be absolutely sure in what you are doing!

You can always use your Terminal and command line to open and edit files as root. Still, command line is not comfortable for everyone to use.

In elementary OS, you can open a new window of the file manager as administrator first and then open and edit all files. But a more convenient way to open a single file from the Pantheon file manager is to create a context menu item Edit as Admin (create a new contract file).

  1. Open your Terminal and run:

cd /usr/share/contractor
  1. Create a new contract file by running the following:

sudo nano io.elementary.code.open-as-root.contract
  1. Enter your admin password.

  2. Insert the following info to the created file:

[Contractor Entry]
Name=Edit as Administrator
Icon=io.elementary11oko.code
Description=Edit file via root user privilege
MimeType=text/plain;
Exec=pkexec io.elementary.code %U
Gettext-Domain=code
  1. Press Ctrl+O to save, and Ctrl+X to exit.

Now when you secondary click a root file in the file manager, you can see the Edit as Administrator context menu item.

Click to open, submit your admin password, and edit the file.

Previous2 AdvancedNextCreate Local Network

Last updated 1 year ago

All thanks to for the manual. Watch the .

📙
📖
Tiwo Satriatama
video guide here