1
$ which gedit
/usr/bin/gedit
$ ls -l /usr/bin/gedit
-rwxr-xr-x. 1 root root 18696 Nov 27 05:55 /usr/bin/gedit
$ gedit
$ # Nothing happens
$ sudo gedit
[sudo] password for user:
$ # gedit window starts
$ # I close the gedit window
$ sudo chmod 0777 /usr/bin/gedit 
$ ls -l /usr/bin/gedit
-rwxrwxrwx. 1 root root 18696 Nov 27 05:55 /usr/bin/gedit
$ gedit
$ # Still nothing happens
$ uname -a
Linux linuxbox 5.4.8-200.fc31.x86_64 #1 SMP Mon Jan 6 16:44:18 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

From a comment at this question, I learned that journalctl --user shows "[l]ogs for end user applications". Running that command, I see no references to gedit.

Why is gedit only runnable with sudo? I am already user user in the log above; I don't understand why it is necessary to do sudo gedit to run this executable.


Update: The context of this question is that I observed that clicking the Text Editor icon in my GNOME 3 desktop environment resulted in nothing happening. From some scrapping about, I discovered the Text Editor icon corresponded to the gedit executable. Thinking that I might have some diagnosable stderr by running gedit from a shell, I did so, and captured the corresponding log above.

StoneThrow
  • 1,717
  • Which user began the graphical session? – John Leuenhagen Jan 15 '20 at 03:30
  • 1
    Probably https://askubuntu.com/a/270019 – muru Jan 15 '20 at 04:02
  • My thinking also. https://unix.stackexchange.com/a/323700/5132 – JdeBP Jan 15 '20 at 09:13
  • @muru - if I understand the accepted answer at that link, the problem is if gedit has created config files owned by root - but from the log I posted, when I type sudo gedit I am asked for user's password - doesn't that mean the config files will be owned by user? – StoneThrow Jan 15 '20 at 18:53
  • @JohnLeuenhagen - As far as I'm aware, user user. I mean: I logged in as user user, and I originally clicked the Text Editor icon in my GNOME desktop environment, and found it failing. Some rummaging around, and I came to the understanding that the Text Editor icon corresponded to the gedit executable. I thought I'd have some form of diagnosable stderr by running gedit from a shell. Thus the log in the original post. – StoneThrow Jan 15 '20 at 18:57
  • 3
    @StoneThrow sudo will always ask for the password of the user executing sudo. sudo gedit would ask for the current user's password, then start gedit as root. Files created by that gedit session would be owned by root. You may want to look at whether gedit's configuration files on your non-privileged user's account are owned by root from having run gedit as root previously. – Kusalananda Jan 15 '20 at 19:08
  • 2
    Never ever change permissions on, or ownership of, random executables on your system. Doing so could introduce serious security holes. You can safely assume that the permissions and ownerships of files installed from a package manager are correct. – Kusalananda Jan 15 '20 at 19:11
  • @Kusalananda - understood; thank you. Original file permissions restored. – StoneThrow Jan 15 '20 at 19:15

0 Answers0