sudo does not open applications

Hi, I’m quite a newbie. I encounter a problem when I want to connect to
the internet. For this, I use

sudo NetworkManager

The problem is that I cannot open any applications anymore after having
used the sudo command (so I also need to open the browser before
connecting to the internet).
The error I get is:

Invalid MIT-MAGIC-COOKIE-1 keyError: cannot open display: :0.0

I have no clue why I suddenly have this problem, since it worked fine
for a couple of days. Can anybody help?


mararie

mararie’s Profile: http://forums.opensuse.org/member.php?userid=16006
View this thread: http://forums.opensuse.org/showthread.php?t=405891

I’ve never used NetworkManager, but supposing it must be run with rooot
privileges, in konsole type
Code:

su -

enter password for root user and hit enter, then enter
Code:

NetworkManager

. After this try to open other applications like browser as normal user.
I’m not sure it’ll work, but it’s worth trying.


arcull

arcull’s Profile: http://forums.opensuse.org/member.php?userid=11668
View this thread: http://forums.opensuse.org/showthread.php?t=405891

arcull wrote:

>
> I’ve never used NetworkManager, but supposing it must be run with rooot
> privileges, in konsole type
> Code:
> --------------------
> su -
> --------------------
> enter password for root user and hit enter, then enter
> Code:
> --------------------
> NetworkManager
> --------------------
> . After this try to open other applications like browser as normal user.
> I’m not sure it’ll work, but it’s worth trying.
>
>

WARNING su - will leave you logged in as root. Just do the (very few things
you need to do such as NetworkManager) and then exit/Ctrl-D back to being a
normal user - the bash prompt should tell you who you are - if in any doubt
log all the way out and back in again. You definitely don’t want to do
things like browse the internet as root :slight_smile:

Alan


email =~ s/nospam/fudokai/

ajp wrote:
> WARNING su - will leave you logged in as root. Just do the (very few things
> you need to do such as NetworkManager) and then exit/Ctrl-D back to being a
> normal user - the bash prompt should tell you who you are - if in any doubt
> log all the way out and back in again. You definitely don’t want to do
> things like browse the internet as root :slight_smile:

One doesn’t normally browse the internet via a bash shell. If you start
Firefox (or another browser) from the CLI while root, you would be, but
most likely one would just click on the icon on the desktop or menu
which would start the browser as a normal user. It neither knows nor
cares that there is a terminal open as root…

…Kevin

Kevin Miller
Juneau, Alaska
http://www.alaska.net/~atftb

If you’re using the kde desktop instead of trying to use sudo use:
kdesu

Should ask for the root password and run the command when successfully
entered

When you use kdesu you’re only root for that particular command whereas
using su means you stay as root until you end the session

There’s probably a gnome equivalent if that’s the desktop you use but I
don’t know it

You can also make a menu shortcut run a program as root instead of your
user as I’ve done with gparted

Right-click the shortcut and click Edit Item, look for a ‘Run as
different user’ box, tick the checkbox and enter root as the value in
the text box, hit File, Save

Next time you click the icon you should be asked for the root password


Ecky

Ecky’s Profile: http://forums.opensuse.org/member.php?userid=3518
View this thread: http://forums.opensuse.org/showthread.php?t=405891

But why browse as root? This never happened in all suse installs I’ve
seen, sounds very unsecure. There’s something wrong here the OP should
try to fix first. Maybe it’s just a question of adding oneself to the
appropriate group?

I’d recommend the OP to post again in the Network/Internet forum, this
is Applications. People more knowledgeable than me will solve this
easily.


brunomcl

brunomcl’s Profile: http://forums.opensuse.org/member.php?userid=8892
View this thread: http://forums.opensuse.org/showthread.php?t=405891

thank you all for your answers! it now works when i use the command
xhost + before opening networkmanager, but this is probably not the best
solution.
thanks brunomcl for the suggestion to post this on the network/internet
forum, i’ll try that forum too.


mararie

mararie’s Profile: http://forums.opensuse.org/member.php?userid=16006
View this thread: http://forums.opensuse.org/showthread.php?t=405891

Ecky;1934077 Wrote:
> There’s probably a gnome equivalent if that’s the desktop you use but I
> don’t know it
> …
>

gksudo or gnomesu depending on distro / what you have installed, I
believe…


Confuseling

Confuseling’s Profile: http://forums.opensuse.org/member.php?userid=16190
View this thread: http://forums.opensuse.org/showthread.php?t=405891