Arch Linux and running applications in terminal as root.

Want to run app as root from the terminal? Its a bad idea from a security point of view. You need it for debugging / testing for permission issues? Ok I guess…

Running application from terminal as root will give You errors:

[root@wishmasus andrzejl]# systemsettings
No protocol specified
systemsettings: cannot connect to X server :0

[root@wishmasus andrzejl]#

To fix this add these 2 lines (modified properly):

export XAUTHORITY=/home/username/.Xauthority
export $(dbus-launch)

to this file:

/root/.bashrc

Close the terminal, re-open it, use su to gain root’s privilages and try running application again.

IF You don’t want to add this line:

export $(dbus-launch)

You can skip it but then some of the apps will spit out errors:

[root@wishmasus andrzejl]# systemsettings
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
systemsettings(6839): KUniqueApplication: Cannot find the D-Bus session server: “Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.”

systemsettings(6838): KUniqueApplication: Pipe closed unexpectedly.

[root@wishmasus andrzejl]#

and You will need to start them with dbus-launch prefix like this:

dbus-launch systemsettings

Cheers.

Andrzej

AndrzejL

"Never meet Your heroes. Most of the time you'll only end up disappointed." White Polak Male Husband Employee Hetero Carnivorous Fugly Geek @$$hole with ADD Catholic “Some men just want to watch the world burn.”

Comments are closed.