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

Opening Code first time via root results in access denied for new files #932

Closed
ayoungethan opened this issue Jan 27, 2021 · 3 comments · Fixed by #951
Closed

Opening Code first time via root results in access denied for new files #932

ayoungethan opened this issue Jan 27, 2021 · 3 comments · Fixed by #951

Comments

@ayoungethan
Copy link

ayoungethan commented Jan 27, 2021

I just installed the latest elementary os: elementary OS 5.1.7 Hera

I had accidentally used the wrong computer name. So the first thing I did after the first boot was open a terminal and

sudo io.elementary.code /etc/hostname
and
sudo io.elementary.code /etc/hosts

After this, I get

[FATAL 22:28:43.138423] DocumentView.vala:151: Error opening file “/home/ayoungethan/.local/share/io.elementary.code/unsaved/Text file from 2021-01-26 22:28:43:138313”: Permission denied

When I try to open or edit a new file by default without superuser privileges.

Changing permissions in ~/.local/share/io.elementary.code appears to fix the issue. eg

sudo chown -R ayoungethan ~/.local/share/io.elementary.code

I believe if a user opens io.elementary.code using superuser privileges, it should not create a root-level folder in the user's home folder.

@danirabbit
Copy link
Member

You should never run GUI apps with sudo for precisely this reason.

I think we may have a safeguard in place for Files that refuses to run with sudo and recommends pkexec instead. We should probably do the same here

@ayoungethan
Copy link
Author

Sounds good to me! There are many websites that give examples and tips using sudo gedit... etc.

A safeguard that refuses a bad command and recommends a better alternative would be a lot easier than trying to convince the entire web to behave better :)

Is the safeguard implemented per-app or can it be implemented per app category to handle all text editors? I am thinking of the user that might read the same tip and download gedit specifically to run sudo gedit...

@danirabbit
Copy link
Member

As far as I know there would not be any real way to globally identify graphical apps to sudo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants