SCIENTIFIC-LINUX-USERS Archives

August 2015

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Fri, 28 Aug 2015 05:00:23 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (49 lines)
On Thu, Aug 27, 2015 at 12:29 PM, Nico Kadel-Garcia <[log in to unmask]> wrote:
> On Thu, Aug 27, 2015 at 9:08 AM, Tom H <[log in to unmask]> wrote:
>> On Mon, Aug 24, 2015 at 6:54 PM, ToddAndMargo <[log in to unmask]> wrote:
>>>
>>> I can run anything as a regular user but not my apps
>>> as root. I am sure a reboot will fix this, but
>>> is there a way to fix this without rebooting?
>>>
>>> This started after I fired up two VM's in KVM
>>>
>>> # leafpad smb.conf &
>>> [1] 16905
>>> [root@localhost samba]# No protocol specified
>>> leafpad: Cannot open display:
>>>
>>> # echo $DISPLAY
>>> :0.0
>>
>> You need to specify XAUTHORITY=
>
> Doing a "sudo" or "su" to run things as the root user can also clear
> your individual user X settings, as can using ssh to access the local
> system as a root user if you do not allow X forwarding.

Whether using su or sudo, you can set DISPLAY and XAUTHORITY to those
of the user from whom you're switching.

I don't use root with GUI apps so this is theoretical knowledge.

You could set up a polkit action/policy (mimicking
/usr/share/polkit-1/actions/com.ubuntu.update-notifier.policy on my
laptop running Ubuntu):

<policyconfig>
  <action id="com.todd.pkexec.leafpad">
    <message>Authentication is required to run leafpad as root</message>
    <icon_name>leafpad</icon_name>
    <defaults>
      <allow_any>no</allow_any>
      <allow_inactive>no</allow_inactive>
      <allow_active>auth_admin</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/leafpad</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
  </action>
</policyconfig>

And you'll then be able to run (as a member of wheel) "pkexec leafpad &".

ATOM RSS1 RSS2