Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gedit should be opened with root or sudo for files belonging to root. #62

Closed
stuaxo opened this issue Aug 28, 2020 · 6 comments
Closed
Labels
Fix Released The fix was released.

Comments

@stuaxo
Copy link

stuaxo commented Aug 28, 2020

Use case:

  • User has invalid desktop file owned by root.

Currently the user will click to edit the file, it will open in gedit and they cannot save it.

What should happen: There should be a prompt to get root permissions and then gedit opened by root.

I'm not sure if there is a HIG / GNOME compliant way of doing the GUI for this, but if there is it should be followed.

@stuaxo
Copy link
Author

stuaxo commented Dec 9, 2020

Came back to report this, though maybe this should be something that Gedit itself can do TBH.

@stuaxo
Copy link
Author

stuaxo commented Dec 9, 2020

If it's a local file then it can be opened with admin admin:// prefixed to it, and prompting will happen automatically.

@bluesabre
Copy link
Owner

@stuaxo I pushed a commit that should handle this scenario. Can you test it out?

@stuaxo
Copy link
Author

stuaxo commented Mar 25, 2021

I get password popup, but after I enter my password nothing happens.

In the log I can see this message:

(gedit:1131169): Gtk-WARNING **: 14:17:45.621: cannot open display: 
Unable to init server: Could not connect: Connection refused

(gedit:1132969): Gtk-WARNING **: 14:18:17.964: cannot open display: 

@TomaszGasior
Copy link

@bluesabre You should never open GUI apps as root, even through pkexec. This is insecure and unsupported in Wayland. Instead, use admin:// protocol for editors like gedit (and forks, and maybe mousepad etc.). This works only with GIO/GVFS-based editors but root privileges are handled automatically and GUI is ran as current desktop user.

bluesabre added a commit that referenced this issue May 28, 2022
- Use admin:// protocol for supported editors gedit, pluma
- Prefer admin-protocol supporting editors
- Check for Wayland before using pkexec
- Fail gracefully for no editors found
@bluesabre
Copy link
Owner

@stuaxo @TomaszGasior Thanks for the feedback. I just pushed up another change that should do the best-case scenario for supported editors. Tested with Gedit (admin:// supported), Pluma (admin:// supported), Mousepad (pkexec), and elementary Code (pkexec).

@bluesabre bluesabre added the Fix Released The fix was released. label Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Released The fix was released.
Projects
None yet
Development

No branches or pull requests

3 participants