What specific bad things happen when gedit is used with sudo?
I read this answer explaining that "sometimes" root can own something at /home/$USER
directory.
Can anyone give an example how to prove it. Just give a test case when something really bad happens, when I run
sudo gedit /etc/rc.local
edit file and save.
I got many downvotes trying to help OP out and comments flooded in saying that it is a crime to run gedit with sudo.
Can anyone give a real example?
I clearly explained why this question is not a duplicate. There is no answer specific to gedit to the linked question.
And it is important to explain why widely used sudo gedit
is bad, or not really, etc.
sudo root configuration gedit ownership
|
show 14 more comments
I read this answer explaining that "sometimes" root can own something at /home/$USER
directory.
Can anyone give an example how to prove it. Just give a test case when something really bad happens, when I run
sudo gedit /etc/rc.local
edit file and save.
I got many downvotes trying to help OP out and comments flooded in saying that it is a crime to run gedit with sudo.
Can anyone give a real example?
I clearly explained why this question is not a duplicate. There is no answer specific to gedit to the linked question.
And it is important to explain why widely used sudo gedit
is bad, or not really, etc.
sudo root configuration gedit ownership
2
Always used it with sudo, never got a problem. Good question.
– Dario Salvati
Jun 5 '15 at 21:26
1
@Wilf, nano likes to write ~/.nano_history which if you run it with sudo causes the file to be owned by root, so when you run nano without sudo it complains that it can't access the file. A simplesudo chown
fixes it.
– psusi
Jun 5 '15 at 22:06
1
As far as rc.local goes , that's a run level script, it should be owned by root hence sudo has no effect on it. Try it with ~/.bashrc. I don't think shell will accept that file if it's owned by root and should regress to default settings. But that's just a suggestion. I'll be back tomorrow, see how this question does
– Sergiy Kolodyazhnyy
Jun 5 '15 at 22:22
1
For most editors it is not the opening, its pressing SAVE. mOst editros also save setting s somewhere, so if you/it modify settings it wil update them.
– Wilf
Jun 5 '15 at 22:31
2
For what it's worth, I just edit it in-place to use-H
when I see it.
– muru
Jun 6 '15 at 0:07
|
show 14 more comments
I read this answer explaining that "sometimes" root can own something at /home/$USER
directory.
Can anyone give an example how to prove it. Just give a test case when something really bad happens, when I run
sudo gedit /etc/rc.local
edit file and save.
I got many downvotes trying to help OP out and comments flooded in saying that it is a crime to run gedit with sudo.
Can anyone give a real example?
I clearly explained why this question is not a duplicate. There is no answer specific to gedit to the linked question.
And it is important to explain why widely used sudo gedit
is bad, or not really, etc.
sudo root configuration gedit ownership
I read this answer explaining that "sometimes" root can own something at /home/$USER
directory.
Can anyone give an example how to prove it. Just give a test case when something really bad happens, when I run
sudo gedit /etc/rc.local
edit file and save.
I got many downvotes trying to help OP out and comments flooded in saying that it is a crime to run gedit with sudo.
Can anyone give a real example?
I clearly explained why this question is not a duplicate. There is no answer specific to gedit to the linked question.
And it is important to explain why widely used sudo gedit
is bad, or not really, etc.
sudo root configuration gedit ownership
sudo root configuration gedit ownership
edited Sep 11 '17 at 18:31
Eliah Kagan
82.1k21227366
82.1k21227366
asked Jun 5 '15 at 21:21
Pilot6Pilot6
52k15107197
52k15107197
2
Always used it with sudo, never got a problem. Good question.
– Dario Salvati
Jun 5 '15 at 21:26
1
@Wilf, nano likes to write ~/.nano_history which if you run it with sudo causes the file to be owned by root, so when you run nano without sudo it complains that it can't access the file. A simplesudo chown
fixes it.
– psusi
Jun 5 '15 at 22:06
1
As far as rc.local goes , that's a run level script, it should be owned by root hence sudo has no effect on it. Try it with ~/.bashrc. I don't think shell will accept that file if it's owned by root and should regress to default settings. But that's just a suggestion. I'll be back tomorrow, see how this question does
– Sergiy Kolodyazhnyy
Jun 5 '15 at 22:22
1
For most editors it is not the opening, its pressing SAVE. mOst editros also save setting s somewhere, so if you/it modify settings it wil update them.
– Wilf
Jun 5 '15 at 22:31
2
For what it's worth, I just edit it in-place to use-H
when I see it.
– muru
Jun 6 '15 at 0:07
|
show 14 more comments
2
Always used it with sudo, never got a problem. Good question.
– Dario Salvati
Jun 5 '15 at 21:26
1
@Wilf, nano likes to write ~/.nano_history which if you run it with sudo causes the file to be owned by root, so when you run nano without sudo it complains that it can't access the file. A simplesudo chown
fixes it.
– psusi
Jun 5 '15 at 22:06
1
As far as rc.local goes , that's a run level script, it should be owned by root hence sudo has no effect on it. Try it with ~/.bashrc. I don't think shell will accept that file if it's owned by root and should regress to default settings. But that's just a suggestion. I'll be back tomorrow, see how this question does
– Sergiy Kolodyazhnyy
Jun 5 '15 at 22:22
1
For most editors it is not the opening, its pressing SAVE. mOst editros also save setting s somewhere, so if you/it modify settings it wil update them.
– Wilf
Jun 5 '15 at 22:31
2
For what it's worth, I just edit it in-place to use-H
when I see it.
– muru
Jun 6 '15 at 0:07
2
2
Always used it with sudo, never got a problem. Good question.
– Dario Salvati
Jun 5 '15 at 21:26
Always used it with sudo, never got a problem. Good question.
– Dario Salvati
Jun 5 '15 at 21:26
1
1
@Wilf, nano likes to write ~/.nano_history which if you run it with sudo causes the file to be owned by root, so when you run nano without sudo it complains that it can't access the file. A simple
sudo chown
fixes it.– psusi
Jun 5 '15 at 22:06
@Wilf, nano likes to write ~/.nano_history which if you run it with sudo causes the file to be owned by root, so when you run nano without sudo it complains that it can't access the file. A simple
sudo chown
fixes it.– psusi
Jun 5 '15 at 22:06
1
1
As far as rc.local goes , that's a run level script, it should be owned by root hence sudo has no effect on it. Try it with ~/.bashrc. I don't think shell will accept that file if it's owned by root and should regress to default settings. But that's just a suggestion. I'll be back tomorrow, see how this question does
– Sergiy Kolodyazhnyy
Jun 5 '15 at 22:22
As far as rc.local goes , that's a run level script, it should be owned by root hence sudo has no effect on it. Try it with ~/.bashrc. I don't think shell will accept that file if it's owned by root and should regress to default settings. But that's just a suggestion. I'll be back tomorrow, see how this question does
– Sergiy Kolodyazhnyy
Jun 5 '15 at 22:22
1
1
For most editors it is not the opening, its pressing SAVE. mOst editros also save setting s somewhere, so if you/it modify settings it wil update them.
– Wilf
Jun 5 '15 at 22:31
For most editors it is not the opening, its pressing SAVE. mOst editros also save setting s somewhere, so if you/it modify settings it wil update them.
– Wilf
Jun 5 '15 at 22:31
2
2
For what it's worth, I just edit it in-place to use
-H
when I see it.– muru
Jun 6 '15 at 0:07
For what it's worth, I just edit it in-place to use
-H
when I see it.– muru
Jun 6 '15 at 0:07
|
show 14 more comments
2 Answers
2
active
oldest
votes
As far as sudo gedit
, nothing dire, just poor practice, especially as of late. How much harder would it be to suggest sudo -H gedit
?
-H
,--set-home
Request that the security policy set the HOME environment variable to the home directory specified by the target user's password database entry. Depending on the policy, this may be the default behavior.
What does happen?
You get a couple of root owned files in your home folder. One (recently-used.xbel
) will likely return to user ownership. This can happen when a file is deleted and re-created. To see what sudo gedit
has changed, run find ~ -user root -group root
and see what is returned. By default, this is should be nothing.
With that command, you may see a couple files owned by root. One would be a new .file
, .gvfs
, and sooner or later a root-owned ~/.cache/dconf
and the aforementioned recently-used.xbel
.
So no 'the sky is failing' stuff, but still. Now there have been reports that continued use causes other issues but not going to claim what I don't see here.
Also note that as of 13.10 a sudo gedit
will use the user's gedit config rather than root's gedit config. Again just bad practice so why continue to do so or suggest others do so?
That was a really good answer, thanks. :-)
– Pilot6
Jun 5 '15 at 23:42
1
Sometimes I now also take the opportunity to show users how to use nano as it's easy & most times can supplant gedit. There are some cases though where gedit is still better than nano even for those that know how to use. Also sudo gedit can lead to sudo nautilus which probably is worse.. ( Here I have a pkexec enabled gedit but thats beyond the scope of this discussion
– doug
Jun 5 '15 at 23:48
@wjandrea, sounds good, edited
– doug
Sep 11 '17 at 23:44
add a comment |
Well maybe it's a fantasy, but there are a number of people saying the same thing:
Why should I use gksudo for Gtk apps instead of sudo?
There are other times, though, when side effects can be as mild as Firefox extensions not sticking or as extreme as as not being able to log in any more because the permissions on your .ICEauthority changed.
Why should users never use normal sudo to start graphical applications?
Suppose you're running gedit (a graphical text editor) as root. If you run sudo gedit, HOME will continue to point toward your home directory, even though the program is running as root. Consequently, gedit will write configuration files as root into your home directory. This will sometimes result in the configuration files being owned by root and thus inaccessible to you (when you later run the program as yourself and not as root).
How to run a GUI program as a different user (Debian)?
First off, don't use sudo or su to change users to run a graphical process, or you're liable to have problems down the line (~/.ICEauthority changing owner is a notable issue). Instead, create a shortcut that uses the following command:
Running Sudo Graphically
Well, to be perfectly honest, most of the time it isn't. For a lot of applications, you can run them the improper way—using sudo for graphical applications and see no adverse side effects.
...
These errors occur because sometimes when
sudo
launches an application, it launches with root privileges but uses the user's configuration file.
This mail archive may also be of interest to you.
So, let's test it.
2 brand new virtual boxes. Ubuntu 14.04. Never run firefox on them. What will happen when I run the command sudo firefox
?
tim@Hairy14CVB:~$ sudo firefox
(process:4857): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
...
shutdownObserver@XPIProvider.jsm:2192:13
This is the same (or at least very similar) for both virtual boxes. While firefox was running, I installed a youtube extension - a featured one. Then I closed firefox, and checked the output.
tim@Hairy14CVB:~$ ls -la .ICEauthority
-rw------- 1 tim tim 1336 Jun 4 21:31 .ICEauthority
Well, .ICEauthority
is fine! However...
tim@Hairy14CVB:~$ ls -la | grep root
drwxr-xr-x 3 root root 4096 Jun 1 20:49 ..
drwx------ 3 root root 4096 Jun 5 22:41 .dbus
drwx------ 4 root root 4096 Jun 5 22:41 .mozilla
3 things in my home folder (/home/tim/
) are owned by root (..
, .dbus
and .mozilla
). This is the same (or at least very similar) for both virtual boxes.
So, does this matter. I wasn't sure, so I ran firefox, like this:
tim@Hairy14CVB:~$ firefox
(process:4959): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Error: Access was denied while trying to open files in your profile directory.
And this ugly error:
For the full terminal output (including firefox babble), see these two pastebins, here and here.
I can still run firefox as root by the way. But now more files have been changed:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
drwx------ 3 root root 4096 Jun 5 22:55 .adobe
drwx------ 3 root root 4096 Jun 5 22:40 .dbus
drwx------ 3 root root 4096 Jun 5 22:55 .macromedia
drwx------ 4 root root 4096 Jun 5 22:40 .mozilla
Was this because I uploaded an image to imgur.com? Not sure.
How did I fix this? chown
. I don't understand it, but the internet said to do it, and it's a Virtual Box so yolo.
sudo chown -R tim:tim /home/tim/
And that fixed it. Now the output is just the ..
file:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
And that's the same on my actual computer. Oh, and on my Kubuntu virtualbox:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 3 root root 4096 May 16 14:10 ..
Which I've never even run a sudo command on. So all is well. Just don't run sudo
on a GUI application.
Final test: run it with the -H
and the -i
flags:
sudo -H firefox
and
sudo -i firefox
And good news! Still, the only root "thing" is ..
. And I can run firefox
without root.
OP wants me to talk about Gedit.
I ran
sudo gedit
Then installed some random plugins. This was the output:
tim@Hairy14VB:~$ ls -la | grep root
ls: cannot access .gvfs: Permission denied
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
Note that I can't even view the ownership of .gvfs
so I did this:
tim@Hairy14VB:~$ sudo ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
dr-x------ 2 root root 0 Jun 6 10:05 .gvfs
So running sudo gedit
does change a file in my home directory to root.
I can still open gedit, but this time I get some garbage out:
(gedit:7422): Gtk-WARNING **: Attempting to read the recently used resources file at `/home/tim/.local/share/recently-used.xbel', but the parser failed: Failed to open file '/home/tim/.local/share/recently-used.xbel': Permission denied.
And that suggests there is another file (~.local/share/recently-used.xbel
) that's been changed. I think this is the Recently used list of files and (lucky guess) I now no longer have my list of recently used files:
There should be a file there called output2.txt.save2
.
1
You wrote everything but the answer to the question. Just give a test case with gedit. Should I flag as "not an answer"? Or "very bad quality" though long ?)))
– Pilot6
Jun 5 '15 at 22:14
5
@Pilot6 - in the questionCan anyone give an example how to prove it ..... Can anyone give a real example?
- and this links to past stuff and gives a example of what can happen with firefox as root - Should I flag your comment 'not constructive' as I can't find 'weirdly grumpy'? be nice cmon :)
– Wilf
Jun 5 '15 at 22:22
1
Oh please don't usels -la|grep root
but eitherfind . -uid 0
orfind . -user root
– solsTiCe
Jun 5 '15 at 23:09
1
@Pilot6 okay, I've edited to include some stuff about gedit. I don't think it adds anything to my answer, but you seem to want it so...
– Tim
Jun 6 '15 at 9:47
4
Both the citations and the detailed examples make this super-useful! I'm glad you added Gedit but I agree with @Wilf that it was good even before. It is not merely Gedit examples that I (deliberately) didn't include there. If people want, I can add a short note there about the "sometimes," but I really think this question is separate and I've voted to reopen. If we reopen this, I'll try and add another answer with more details about Gedit, but this will still be the most useful answer for most people.
– Eliah Kagan
Sep 11 '17 at 18:05
|
show 5 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f632798%2fwhat-specific-bad-things-happen-when-gedit-is-used-with-sudo%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
As far as sudo gedit
, nothing dire, just poor practice, especially as of late. How much harder would it be to suggest sudo -H gedit
?
-H
,--set-home
Request that the security policy set the HOME environment variable to the home directory specified by the target user's password database entry. Depending on the policy, this may be the default behavior.
What does happen?
You get a couple of root owned files in your home folder. One (recently-used.xbel
) will likely return to user ownership. This can happen when a file is deleted and re-created. To see what sudo gedit
has changed, run find ~ -user root -group root
and see what is returned. By default, this is should be nothing.
With that command, you may see a couple files owned by root. One would be a new .file
, .gvfs
, and sooner or later a root-owned ~/.cache/dconf
and the aforementioned recently-used.xbel
.
So no 'the sky is failing' stuff, but still. Now there have been reports that continued use causes other issues but not going to claim what I don't see here.
Also note that as of 13.10 a sudo gedit
will use the user's gedit config rather than root's gedit config. Again just bad practice so why continue to do so or suggest others do so?
That was a really good answer, thanks. :-)
– Pilot6
Jun 5 '15 at 23:42
1
Sometimes I now also take the opportunity to show users how to use nano as it's easy & most times can supplant gedit. There are some cases though where gedit is still better than nano even for those that know how to use. Also sudo gedit can lead to sudo nautilus which probably is worse.. ( Here I have a pkexec enabled gedit but thats beyond the scope of this discussion
– doug
Jun 5 '15 at 23:48
@wjandrea, sounds good, edited
– doug
Sep 11 '17 at 23:44
add a comment |
As far as sudo gedit
, nothing dire, just poor practice, especially as of late. How much harder would it be to suggest sudo -H gedit
?
-H
,--set-home
Request that the security policy set the HOME environment variable to the home directory specified by the target user's password database entry. Depending on the policy, this may be the default behavior.
What does happen?
You get a couple of root owned files in your home folder. One (recently-used.xbel
) will likely return to user ownership. This can happen when a file is deleted and re-created. To see what sudo gedit
has changed, run find ~ -user root -group root
and see what is returned. By default, this is should be nothing.
With that command, you may see a couple files owned by root. One would be a new .file
, .gvfs
, and sooner or later a root-owned ~/.cache/dconf
and the aforementioned recently-used.xbel
.
So no 'the sky is failing' stuff, but still. Now there have been reports that continued use causes other issues but not going to claim what I don't see here.
Also note that as of 13.10 a sudo gedit
will use the user's gedit config rather than root's gedit config. Again just bad practice so why continue to do so or suggest others do so?
That was a really good answer, thanks. :-)
– Pilot6
Jun 5 '15 at 23:42
1
Sometimes I now also take the opportunity to show users how to use nano as it's easy & most times can supplant gedit. There are some cases though where gedit is still better than nano even for those that know how to use. Also sudo gedit can lead to sudo nautilus which probably is worse.. ( Here I have a pkexec enabled gedit but thats beyond the scope of this discussion
– doug
Jun 5 '15 at 23:48
@wjandrea, sounds good, edited
– doug
Sep 11 '17 at 23:44
add a comment |
As far as sudo gedit
, nothing dire, just poor practice, especially as of late. How much harder would it be to suggest sudo -H gedit
?
-H
,--set-home
Request that the security policy set the HOME environment variable to the home directory specified by the target user's password database entry. Depending on the policy, this may be the default behavior.
What does happen?
You get a couple of root owned files in your home folder. One (recently-used.xbel
) will likely return to user ownership. This can happen when a file is deleted and re-created. To see what sudo gedit
has changed, run find ~ -user root -group root
and see what is returned. By default, this is should be nothing.
With that command, you may see a couple files owned by root. One would be a new .file
, .gvfs
, and sooner or later a root-owned ~/.cache/dconf
and the aforementioned recently-used.xbel
.
So no 'the sky is failing' stuff, but still. Now there have been reports that continued use causes other issues but not going to claim what I don't see here.
Also note that as of 13.10 a sudo gedit
will use the user's gedit config rather than root's gedit config. Again just bad practice so why continue to do so or suggest others do so?
As far as sudo gedit
, nothing dire, just poor practice, especially as of late. How much harder would it be to suggest sudo -H gedit
?
-H
,--set-home
Request that the security policy set the HOME environment variable to the home directory specified by the target user's password database entry. Depending on the policy, this may be the default behavior.
What does happen?
You get a couple of root owned files in your home folder. One (recently-used.xbel
) will likely return to user ownership. This can happen when a file is deleted and re-created. To see what sudo gedit
has changed, run find ~ -user root -group root
and see what is returned. By default, this is should be nothing.
With that command, you may see a couple files owned by root. One would be a new .file
, .gvfs
, and sooner or later a root-owned ~/.cache/dconf
and the aforementioned recently-used.xbel
.
So no 'the sky is failing' stuff, but still. Now there have been reports that continued use causes other issues but not going to claim what I don't see here.
Also note that as of 13.10 a sudo gedit
will use the user's gedit config rather than root's gedit config. Again just bad practice so why continue to do so or suggest others do so?
edited yesterday
Pablo Bianchi
2,6151532
2,6151532
answered Jun 5 '15 at 23:10
dougdoug
14.2k13553
14.2k13553
That was a really good answer, thanks. :-)
– Pilot6
Jun 5 '15 at 23:42
1
Sometimes I now also take the opportunity to show users how to use nano as it's easy & most times can supplant gedit. There are some cases though where gedit is still better than nano even for those that know how to use. Also sudo gedit can lead to sudo nautilus which probably is worse.. ( Here I have a pkexec enabled gedit but thats beyond the scope of this discussion
– doug
Jun 5 '15 at 23:48
@wjandrea, sounds good, edited
– doug
Sep 11 '17 at 23:44
add a comment |
That was a really good answer, thanks. :-)
– Pilot6
Jun 5 '15 at 23:42
1
Sometimes I now also take the opportunity to show users how to use nano as it's easy & most times can supplant gedit. There are some cases though where gedit is still better than nano even for those that know how to use. Also sudo gedit can lead to sudo nautilus which probably is worse.. ( Here I have a pkexec enabled gedit but thats beyond the scope of this discussion
– doug
Jun 5 '15 at 23:48
@wjandrea, sounds good, edited
– doug
Sep 11 '17 at 23:44
That was a really good answer, thanks. :-)
– Pilot6
Jun 5 '15 at 23:42
That was a really good answer, thanks. :-)
– Pilot6
Jun 5 '15 at 23:42
1
1
Sometimes I now also take the opportunity to show users how to use nano as it's easy & most times can supplant gedit. There are some cases though where gedit is still better than nano even for those that know how to use. Also sudo gedit can lead to sudo nautilus which probably is worse.. ( Here I have a pkexec enabled gedit but thats beyond the scope of this discussion
– doug
Jun 5 '15 at 23:48
Sometimes I now also take the opportunity to show users how to use nano as it's easy & most times can supplant gedit. There are some cases though where gedit is still better than nano even for those that know how to use. Also sudo gedit can lead to sudo nautilus which probably is worse.. ( Here I have a pkexec enabled gedit but thats beyond the scope of this discussion
– doug
Jun 5 '15 at 23:48
@wjandrea, sounds good, edited
– doug
Sep 11 '17 at 23:44
@wjandrea, sounds good, edited
– doug
Sep 11 '17 at 23:44
add a comment |
Well maybe it's a fantasy, but there are a number of people saying the same thing:
Why should I use gksudo for Gtk apps instead of sudo?
There are other times, though, when side effects can be as mild as Firefox extensions not sticking or as extreme as as not being able to log in any more because the permissions on your .ICEauthority changed.
Why should users never use normal sudo to start graphical applications?
Suppose you're running gedit (a graphical text editor) as root. If you run sudo gedit, HOME will continue to point toward your home directory, even though the program is running as root. Consequently, gedit will write configuration files as root into your home directory. This will sometimes result in the configuration files being owned by root and thus inaccessible to you (when you later run the program as yourself and not as root).
How to run a GUI program as a different user (Debian)?
First off, don't use sudo or su to change users to run a graphical process, or you're liable to have problems down the line (~/.ICEauthority changing owner is a notable issue). Instead, create a shortcut that uses the following command:
Running Sudo Graphically
Well, to be perfectly honest, most of the time it isn't. For a lot of applications, you can run them the improper way—using sudo for graphical applications and see no adverse side effects.
...
These errors occur because sometimes when
sudo
launches an application, it launches with root privileges but uses the user's configuration file.
This mail archive may also be of interest to you.
So, let's test it.
2 brand new virtual boxes. Ubuntu 14.04. Never run firefox on them. What will happen when I run the command sudo firefox
?
tim@Hairy14CVB:~$ sudo firefox
(process:4857): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
...
shutdownObserver@XPIProvider.jsm:2192:13
This is the same (or at least very similar) for both virtual boxes. While firefox was running, I installed a youtube extension - a featured one. Then I closed firefox, and checked the output.
tim@Hairy14CVB:~$ ls -la .ICEauthority
-rw------- 1 tim tim 1336 Jun 4 21:31 .ICEauthority
Well, .ICEauthority
is fine! However...
tim@Hairy14CVB:~$ ls -la | grep root
drwxr-xr-x 3 root root 4096 Jun 1 20:49 ..
drwx------ 3 root root 4096 Jun 5 22:41 .dbus
drwx------ 4 root root 4096 Jun 5 22:41 .mozilla
3 things in my home folder (/home/tim/
) are owned by root (..
, .dbus
and .mozilla
). This is the same (or at least very similar) for both virtual boxes.
So, does this matter. I wasn't sure, so I ran firefox, like this:
tim@Hairy14CVB:~$ firefox
(process:4959): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Error: Access was denied while trying to open files in your profile directory.
And this ugly error:
For the full terminal output (including firefox babble), see these two pastebins, here and here.
I can still run firefox as root by the way. But now more files have been changed:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
drwx------ 3 root root 4096 Jun 5 22:55 .adobe
drwx------ 3 root root 4096 Jun 5 22:40 .dbus
drwx------ 3 root root 4096 Jun 5 22:55 .macromedia
drwx------ 4 root root 4096 Jun 5 22:40 .mozilla
Was this because I uploaded an image to imgur.com? Not sure.
How did I fix this? chown
. I don't understand it, but the internet said to do it, and it's a Virtual Box so yolo.
sudo chown -R tim:tim /home/tim/
And that fixed it. Now the output is just the ..
file:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
And that's the same on my actual computer. Oh, and on my Kubuntu virtualbox:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 3 root root 4096 May 16 14:10 ..
Which I've never even run a sudo command on. So all is well. Just don't run sudo
on a GUI application.
Final test: run it with the -H
and the -i
flags:
sudo -H firefox
and
sudo -i firefox
And good news! Still, the only root "thing" is ..
. And I can run firefox
without root.
OP wants me to talk about Gedit.
I ran
sudo gedit
Then installed some random plugins. This was the output:
tim@Hairy14VB:~$ ls -la | grep root
ls: cannot access .gvfs: Permission denied
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
Note that I can't even view the ownership of .gvfs
so I did this:
tim@Hairy14VB:~$ sudo ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
dr-x------ 2 root root 0 Jun 6 10:05 .gvfs
So running sudo gedit
does change a file in my home directory to root.
I can still open gedit, but this time I get some garbage out:
(gedit:7422): Gtk-WARNING **: Attempting to read the recently used resources file at `/home/tim/.local/share/recently-used.xbel', but the parser failed: Failed to open file '/home/tim/.local/share/recently-used.xbel': Permission denied.
And that suggests there is another file (~.local/share/recently-used.xbel
) that's been changed. I think this is the Recently used list of files and (lucky guess) I now no longer have my list of recently used files:
There should be a file there called output2.txt.save2
.
1
You wrote everything but the answer to the question. Just give a test case with gedit. Should I flag as "not an answer"? Or "very bad quality" though long ?)))
– Pilot6
Jun 5 '15 at 22:14
5
@Pilot6 - in the questionCan anyone give an example how to prove it ..... Can anyone give a real example?
- and this links to past stuff and gives a example of what can happen with firefox as root - Should I flag your comment 'not constructive' as I can't find 'weirdly grumpy'? be nice cmon :)
– Wilf
Jun 5 '15 at 22:22
1
Oh please don't usels -la|grep root
but eitherfind . -uid 0
orfind . -user root
– solsTiCe
Jun 5 '15 at 23:09
1
@Pilot6 okay, I've edited to include some stuff about gedit. I don't think it adds anything to my answer, but you seem to want it so...
– Tim
Jun 6 '15 at 9:47
4
Both the citations and the detailed examples make this super-useful! I'm glad you added Gedit but I agree with @Wilf that it was good even before. It is not merely Gedit examples that I (deliberately) didn't include there. If people want, I can add a short note there about the "sometimes," but I really think this question is separate and I've voted to reopen. If we reopen this, I'll try and add another answer with more details about Gedit, but this will still be the most useful answer for most people.
– Eliah Kagan
Sep 11 '17 at 18:05
|
show 5 more comments
Well maybe it's a fantasy, but there are a number of people saying the same thing:
Why should I use gksudo for Gtk apps instead of sudo?
There are other times, though, when side effects can be as mild as Firefox extensions not sticking or as extreme as as not being able to log in any more because the permissions on your .ICEauthority changed.
Why should users never use normal sudo to start graphical applications?
Suppose you're running gedit (a graphical text editor) as root. If you run sudo gedit, HOME will continue to point toward your home directory, even though the program is running as root. Consequently, gedit will write configuration files as root into your home directory. This will sometimes result in the configuration files being owned by root and thus inaccessible to you (when you later run the program as yourself and not as root).
How to run a GUI program as a different user (Debian)?
First off, don't use sudo or su to change users to run a graphical process, or you're liable to have problems down the line (~/.ICEauthority changing owner is a notable issue). Instead, create a shortcut that uses the following command:
Running Sudo Graphically
Well, to be perfectly honest, most of the time it isn't. For a lot of applications, you can run them the improper way—using sudo for graphical applications and see no adverse side effects.
...
These errors occur because sometimes when
sudo
launches an application, it launches with root privileges but uses the user's configuration file.
This mail archive may also be of interest to you.
So, let's test it.
2 brand new virtual boxes. Ubuntu 14.04. Never run firefox on them. What will happen when I run the command sudo firefox
?
tim@Hairy14CVB:~$ sudo firefox
(process:4857): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
...
shutdownObserver@XPIProvider.jsm:2192:13
This is the same (or at least very similar) for both virtual boxes. While firefox was running, I installed a youtube extension - a featured one. Then I closed firefox, and checked the output.
tim@Hairy14CVB:~$ ls -la .ICEauthority
-rw------- 1 tim tim 1336 Jun 4 21:31 .ICEauthority
Well, .ICEauthority
is fine! However...
tim@Hairy14CVB:~$ ls -la | grep root
drwxr-xr-x 3 root root 4096 Jun 1 20:49 ..
drwx------ 3 root root 4096 Jun 5 22:41 .dbus
drwx------ 4 root root 4096 Jun 5 22:41 .mozilla
3 things in my home folder (/home/tim/
) are owned by root (..
, .dbus
and .mozilla
). This is the same (or at least very similar) for both virtual boxes.
So, does this matter. I wasn't sure, so I ran firefox, like this:
tim@Hairy14CVB:~$ firefox
(process:4959): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Error: Access was denied while trying to open files in your profile directory.
And this ugly error:
For the full terminal output (including firefox babble), see these two pastebins, here and here.
I can still run firefox as root by the way. But now more files have been changed:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
drwx------ 3 root root 4096 Jun 5 22:55 .adobe
drwx------ 3 root root 4096 Jun 5 22:40 .dbus
drwx------ 3 root root 4096 Jun 5 22:55 .macromedia
drwx------ 4 root root 4096 Jun 5 22:40 .mozilla
Was this because I uploaded an image to imgur.com? Not sure.
How did I fix this? chown
. I don't understand it, but the internet said to do it, and it's a Virtual Box so yolo.
sudo chown -R tim:tim /home/tim/
And that fixed it. Now the output is just the ..
file:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
And that's the same on my actual computer. Oh, and on my Kubuntu virtualbox:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 3 root root 4096 May 16 14:10 ..
Which I've never even run a sudo command on. So all is well. Just don't run sudo
on a GUI application.
Final test: run it with the -H
and the -i
flags:
sudo -H firefox
and
sudo -i firefox
And good news! Still, the only root "thing" is ..
. And I can run firefox
without root.
OP wants me to talk about Gedit.
I ran
sudo gedit
Then installed some random plugins. This was the output:
tim@Hairy14VB:~$ ls -la | grep root
ls: cannot access .gvfs: Permission denied
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
Note that I can't even view the ownership of .gvfs
so I did this:
tim@Hairy14VB:~$ sudo ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
dr-x------ 2 root root 0 Jun 6 10:05 .gvfs
So running sudo gedit
does change a file in my home directory to root.
I can still open gedit, but this time I get some garbage out:
(gedit:7422): Gtk-WARNING **: Attempting to read the recently used resources file at `/home/tim/.local/share/recently-used.xbel', but the parser failed: Failed to open file '/home/tim/.local/share/recently-used.xbel': Permission denied.
And that suggests there is another file (~.local/share/recently-used.xbel
) that's been changed. I think this is the Recently used list of files and (lucky guess) I now no longer have my list of recently used files:
There should be a file there called output2.txt.save2
.
1
You wrote everything but the answer to the question. Just give a test case with gedit. Should I flag as "not an answer"? Or "very bad quality" though long ?)))
– Pilot6
Jun 5 '15 at 22:14
5
@Pilot6 - in the questionCan anyone give an example how to prove it ..... Can anyone give a real example?
- and this links to past stuff and gives a example of what can happen with firefox as root - Should I flag your comment 'not constructive' as I can't find 'weirdly grumpy'? be nice cmon :)
– Wilf
Jun 5 '15 at 22:22
1
Oh please don't usels -la|grep root
but eitherfind . -uid 0
orfind . -user root
– solsTiCe
Jun 5 '15 at 23:09
1
@Pilot6 okay, I've edited to include some stuff about gedit. I don't think it adds anything to my answer, but you seem to want it so...
– Tim
Jun 6 '15 at 9:47
4
Both the citations and the detailed examples make this super-useful! I'm glad you added Gedit but I agree with @Wilf that it was good even before. It is not merely Gedit examples that I (deliberately) didn't include there. If people want, I can add a short note there about the "sometimes," but I really think this question is separate and I've voted to reopen. If we reopen this, I'll try and add another answer with more details about Gedit, but this will still be the most useful answer for most people.
– Eliah Kagan
Sep 11 '17 at 18:05
|
show 5 more comments
Well maybe it's a fantasy, but there are a number of people saying the same thing:
Why should I use gksudo for Gtk apps instead of sudo?
There are other times, though, when side effects can be as mild as Firefox extensions not sticking or as extreme as as not being able to log in any more because the permissions on your .ICEauthority changed.
Why should users never use normal sudo to start graphical applications?
Suppose you're running gedit (a graphical text editor) as root. If you run sudo gedit, HOME will continue to point toward your home directory, even though the program is running as root. Consequently, gedit will write configuration files as root into your home directory. This will sometimes result in the configuration files being owned by root and thus inaccessible to you (when you later run the program as yourself and not as root).
How to run a GUI program as a different user (Debian)?
First off, don't use sudo or su to change users to run a graphical process, or you're liable to have problems down the line (~/.ICEauthority changing owner is a notable issue). Instead, create a shortcut that uses the following command:
Running Sudo Graphically
Well, to be perfectly honest, most of the time it isn't. For a lot of applications, you can run them the improper way—using sudo for graphical applications and see no adverse side effects.
...
These errors occur because sometimes when
sudo
launches an application, it launches with root privileges but uses the user's configuration file.
This mail archive may also be of interest to you.
So, let's test it.
2 brand new virtual boxes. Ubuntu 14.04. Never run firefox on them. What will happen when I run the command sudo firefox
?
tim@Hairy14CVB:~$ sudo firefox
(process:4857): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
...
shutdownObserver@XPIProvider.jsm:2192:13
This is the same (or at least very similar) for both virtual boxes. While firefox was running, I installed a youtube extension - a featured one. Then I closed firefox, and checked the output.
tim@Hairy14CVB:~$ ls -la .ICEauthority
-rw------- 1 tim tim 1336 Jun 4 21:31 .ICEauthority
Well, .ICEauthority
is fine! However...
tim@Hairy14CVB:~$ ls -la | grep root
drwxr-xr-x 3 root root 4096 Jun 1 20:49 ..
drwx------ 3 root root 4096 Jun 5 22:41 .dbus
drwx------ 4 root root 4096 Jun 5 22:41 .mozilla
3 things in my home folder (/home/tim/
) are owned by root (..
, .dbus
and .mozilla
). This is the same (or at least very similar) for both virtual boxes.
So, does this matter. I wasn't sure, so I ran firefox, like this:
tim@Hairy14CVB:~$ firefox
(process:4959): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Error: Access was denied while trying to open files in your profile directory.
And this ugly error:
For the full terminal output (including firefox babble), see these two pastebins, here and here.
I can still run firefox as root by the way. But now more files have been changed:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
drwx------ 3 root root 4096 Jun 5 22:55 .adobe
drwx------ 3 root root 4096 Jun 5 22:40 .dbus
drwx------ 3 root root 4096 Jun 5 22:55 .macromedia
drwx------ 4 root root 4096 Jun 5 22:40 .mozilla
Was this because I uploaded an image to imgur.com? Not sure.
How did I fix this? chown
. I don't understand it, but the internet said to do it, and it's a Virtual Box so yolo.
sudo chown -R tim:tim /home/tim/
And that fixed it. Now the output is just the ..
file:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
And that's the same on my actual computer. Oh, and on my Kubuntu virtualbox:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 3 root root 4096 May 16 14:10 ..
Which I've never even run a sudo command on. So all is well. Just don't run sudo
on a GUI application.
Final test: run it with the -H
and the -i
flags:
sudo -H firefox
and
sudo -i firefox
And good news! Still, the only root "thing" is ..
. And I can run firefox
without root.
OP wants me to talk about Gedit.
I ran
sudo gedit
Then installed some random plugins. This was the output:
tim@Hairy14VB:~$ ls -la | grep root
ls: cannot access .gvfs: Permission denied
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
Note that I can't even view the ownership of .gvfs
so I did this:
tim@Hairy14VB:~$ sudo ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
dr-x------ 2 root root 0 Jun 6 10:05 .gvfs
So running sudo gedit
does change a file in my home directory to root.
I can still open gedit, but this time I get some garbage out:
(gedit:7422): Gtk-WARNING **: Attempting to read the recently used resources file at `/home/tim/.local/share/recently-used.xbel', but the parser failed: Failed to open file '/home/tim/.local/share/recently-used.xbel': Permission denied.
And that suggests there is another file (~.local/share/recently-used.xbel
) that's been changed. I think this is the Recently used list of files and (lucky guess) I now no longer have my list of recently used files:
There should be a file there called output2.txt.save2
.
Well maybe it's a fantasy, but there are a number of people saying the same thing:
Why should I use gksudo for Gtk apps instead of sudo?
There are other times, though, when side effects can be as mild as Firefox extensions not sticking or as extreme as as not being able to log in any more because the permissions on your .ICEauthority changed.
Why should users never use normal sudo to start graphical applications?
Suppose you're running gedit (a graphical text editor) as root. If you run sudo gedit, HOME will continue to point toward your home directory, even though the program is running as root. Consequently, gedit will write configuration files as root into your home directory. This will sometimes result in the configuration files being owned by root and thus inaccessible to you (when you later run the program as yourself and not as root).
How to run a GUI program as a different user (Debian)?
First off, don't use sudo or su to change users to run a graphical process, or you're liable to have problems down the line (~/.ICEauthority changing owner is a notable issue). Instead, create a shortcut that uses the following command:
Running Sudo Graphically
Well, to be perfectly honest, most of the time it isn't. For a lot of applications, you can run them the improper way—using sudo for graphical applications and see no adverse side effects.
...
These errors occur because sometimes when
sudo
launches an application, it launches with root privileges but uses the user's configuration file.
This mail archive may also be of interest to you.
So, let's test it.
2 brand new virtual boxes. Ubuntu 14.04. Never run firefox on them. What will happen when I run the command sudo firefox
?
tim@Hairy14CVB:~$ sudo firefox
(process:4857): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
...
shutdownObserver@XPIProvider.jsm:2192:13
This is the same (or at least very similar) for both virtual boxes. While firefox was running, I installed a youtube extension - a featured one. Then I closed firefox, and checked the output.
tim@Hairy14CVB:~$ ls -la .ICEauthority
-rw------- 1 tim tim 1336 Jun 4 21:31 .ICEauthority
Well, .ICEauthority
is fine! However...
tim@Hairy14CVB:~$ ls -la | grep root
drwxr-xr-x 3 root root 4096 Jun 1 20:49 ..
drwx------ 3 root root 4096 Jun 5 22:41 .dbus
drwx------ 4 root root 4096 Jun 5 22:41 .mozilla
3 things in my home folder (/home/tim/
) are owned by root (..
, .dbus
and .mozilla
). This is the same (or at least very similar) for both virtual boxes.
So, does this matter. I wasn't sure, so I ran firefox, like this:
tim@Hairy14CVB:~$ firefox
(process:4959): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Error: Access was denied while trying to open files in your profile directory.
And this ugly error:
For the full terminal output (including firefox babble), see these two pastebins, here and here.
I can still run firefox as root by the way. But now more files have been changed:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
drwx------ 3 root root 4096 Jun 5 22:55 .adobe
drwx------ 3 root root 4096 Jun 5 22:40 .dbus
drwx------ 3 root root 4096 Jun 5 22:55 .macromedia
drwx------ 4 root root 4096 Jun 5 22:40 .mozilla
Was this because I uploaded an image to imgur.com? Not sure.
How did I fix this? chown
. I don't understand it, but the internet said to do it, and it's a Virtual Box so yolo.
sudo chown -R tim:tim /home/tim/
And that fixed it. Now the output is just the ..
file:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
And that's the same on my actual computer. Oh, and on my Kubuntu virtualbox:
tim@Hairy14VB:~$ ls -la | grep root
drwxr-xr-x 3 root root 4096 May 16 14:10 ..
Which I've never even run a sudo command on. So all is well. Just don't run sudo
on a GUI application.
Final test: run it with the -H
and the -i
flags:
sudo -H firefox
and
sudo -i firefox
And good news! Still, the only root "thing" is ..
. And I can run firefox
without root.
OP wants me to talk about Gedit.
I ran
sudo gedit
Then installed some random plugins. This was the output:
tim@Hairy14VB:~$ ls -la | grep root
ls: cannot access .gvfs: Permission denied
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
Note that I can't even view the ownership of .gvfs
so I did this:
tim@Hairy14VB:~$ sudo ls -la | grep root
drwxr-xr-x 4 root root 4096 Jun 3 19:46 ..
dr-x------ 2 root root 0 Jun 6 10:05 .gvfs
So running sudo gedit
does change a file in my home directory to root.
I can still open gedit, but this time I get some garbage out:
(gedit:7422): Gtk-WARNING **: Attempting to read the recently used resources file at `/home/tim/.local/share/recently-used.xbel', but the parser failed: Failed to open file '/home/tim/.local/share/recently-used.xbel': Permission denied.
And that suggests there is another file (~.local/share/recently-used.xbel
) that's been changed. I think this is the Recently used list of files and (lucky guess) I now no longer have my list of recently used files:
There should be a file there called output2.txt.save2
.
edited yesterday
Pablo Bianchi
2,6151532
2,6151532
answered Jun 5 '15 at 22:12
TimTim
19.8k1486141
19.8k1486141
1
You wrote everything but the answer to the question. Just give a test case with gedit. Should I flag as "not an answer"? Or "very bad quality" though long ?)))
– Pilot6
Jun 5 '15 at 22:14
5
@Pilot6 - in the questionCan anyone give an example how to prove it ..... Can anyone give a real example?
- and this links to past stuff and gives a example of what can happen with firefox as root - Should I flag your comment 'not constructive' as I can't find 'weirdly grumpy'? be nice cmon :)
– Wilf
Jun 5 '15 at 22:22
1
Oh please don't usels -la|grep root
but eitherfind . -uid 0
orfind . -user root
– solsTiCe
Jun 5 '15 at 23:09
1
@Pilot6 okay, I've edited to include some stuff about gedit. I don't think it adds anything to my answer, but you seem to want it so...
– Tim
Jun 6 '15 at 9:47
4
Both the citations and the detailed examples make this super-useful! I'm glad you added Gedit but I agree with @Wilf that it was good even before. It is not merely Gedit examples that I (deliberately) didn't include there. If people want, I can add a short note there about the "sometimes," but I really think this question is separate and I've voted to reopen. If we reopen this, I'll try and add another answer with more details about Gedit, but this will still be the most useful answer for most people.
– Eliah Kagan
Sep 11 '17 at 18:05
|
show 5 more comments
1
You wrote everything but the answer to the question. Just give a test case with gedit. Should I flag as "not an answer"? Or "very bad quality" though long ?)))
– Pilot6
Jun 5 '15 at 22:14
5
@Pilot6 - in the questionCan anyone give an example how to prove it ..... Can anyone give a real example?
- and this links to past stuff and gives a example of what can happen with firefox as root - Should I flag your comment 'not constructive' as I can't find 'weirdly grumpy'? be nice cmon :)
– Wilf
Jun 5 '15 at 22:22
1
Oh please don't usels -la|grep root
but eitherfind . -uid 0
orfind . -user root
– solsTiCe
Jun 5 '15 at 23:09
1
@Pilot6 okay, I've edited to include some stuff about gedit. I don't think it adds anything to my answer, but you seem to want it so...
– Tim
Jun 6 '15 at 9:47
4
Both the citations and the detailed examples make this super-useful! I'm glad you added Gedit but I agree with @Wilf that it was good even before. It is not merely Gedit examples that I (deliberately) didn't include there. If people want, I can add a short note there about the "sometimes," but I really think this question is separate and I've voted to reopen. If we reopen this, I'll try and add another answer with more details about Gedit, but this will still be the most useful answer for most people.
– Eliah Kagan
Sep 11 '17 at 18:05
1
1
You wrote everything but the answer to the question. Just give a test case with gedit. Should I flag as "not an answer"? Or "very bad quality" though long ?)))
– Pilot6
Jun 5 '15 at 22:14
You wrote everything but the answer to the question. Just give a test case with gedit. Should I flag as "not an answer"? Or "very bad quality" though long ?)))
– Pilot6
Jun 5 '15 at 22:14
5
5
@Pilot6 - in the question
Can anyone give an example how to prove it ..... Can anyone give a real example?
- and this links to past stuff and gives a example of what can happen with firefox as root - Should I flag your comment 'not constructive' as I can't find 'weirdly grumpy'? be nice cmon :)– Wilf
Jun 5 '15 at 22:22
@Pilot6 - in the question
Can anyone give an example how to prove it ..... Can anyone give a real example?
- and this links to past stuff and gives a example of what can happen with firefox as root - Should I flag your comment 'not constructive' as I can't find 'weirdly grumpy'? be nice cmon :)– Wilf
Jun 5 '15 at 22:22
1
1
Oh please don't use
ls -la|grep root
but either find . -uid 0
or find . -user root
– solsTiCe
Jun 5 '15 at 23:09
Oh please don't use
ls -la|grep root
but either find . -uid 0
or find . -user root
– solsTiCe
Jun 5 '15 at 23:09
1
1
@Pilot6 okay, I've edited to include some stuff about gedit. I don't think it adds anything to my answer, but you seem to want it so...
– Tim
Jun 6 '15 at 9:47
@Pilot6 okay, I've edited to include some stuff about gedit. I don't think it adds anything to my answer, but you seem to want it so...
– Tim
Jun 6 '15 at 9:47
4
4
Both the citations and the detailed examples make this super-useful! I'm glad you added Gedit but I agree with @Wilf that it was good even before. It is not merely Gedit examples that I (deliberately) didn't include there. If people want, I can add a short note there about the "sometimes," but I really think this question is separate and I've voted to reopen. If we reopen this, I'll try and add another answer with more details about Gedit, but this will still be the most useful answer for most people.
– Eliah Kagan
Sep 11 '17 at 18:05
Both the citations and the detailed examples make this super-useful! I'm glad you added Gedit but I agree with @Wilf that it was good even before. It is not merely Gedit examples that I (deliberately) didn't include there. If people want, I can add a short note there about the "sometimes," but I really think this question is separate and I've voted to reopen. If we reopen this, I'll try and add another answer with more details about Gedit, but this will still be the most useful answer for most people.
– Eliah Kagan
Sep 11 '17 at 18:05
|
show 5 more comments
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f632798%2fwhat-specific-bad-things-happen-when-gedit-is-used-with-sudo%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Always used it with sudo, never got a problem. Good question.
– Dario Salvati
Jun 5 '15 at 21:26
1
@Wilf, nano likes to write ~/.nano_history which if you run it with sudo causes the file to be owned by root, so when you run nano without sudo it complains that it can't access the file. A simple
sudo chown
fixes it.– psusi
Jun 5 '15 at 22:06
1
As far as rc.local goes , that's a run level script, it should be owned by root hence sudo has no effect on it. Try it with ~/.bashrc. I don't think shell will accept that file if it's owned by root and should regress to default settings. But that's just a suggestion. I'll be back tomorrow, see how this question does
– Sergiy Kolodyazhnyy
Jun 5 '15 at 22:22
1
For most editors it is not the opening, its pressing SAVE. mOst editros also save setting s somewhere, so if you/it modify settings it wil update them.
– Wilf
Jun 5 '15 at 22:31
2
For what it's worth, I just edit it in-place to use
-H
when I see it.– muru
Jun 6 '15 at 0:07