From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1P7SvV-00072U-Sa for garchives@archives.gentoo.org; Sun, 17 Oct 2010 13:05:28 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 15BEDE07C6; Sun, 17 Oct 2010 13:05:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id EB8B3E07C6 for ; Sun, 17 Oct 2010 13:05:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 9975F1B4097 for ; Sun, 17 Oct 2010 13:05:15 +0000 (UTC) X-Virus-Scanned: by amavisd-new using ClamAV at gentoo.org X-Spam-Score: -2.891 X-Spam-Level: X-Spam-Status: No, score=-2.891 required=5.5 tests=[AWL=-0.292, BAYES_00=-2.599] Received: from smtp.gentoo.org ([127.0.0.1]) by localhost (smtp.gentoo.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2swTD+q8bIim for ; Sun, 17 Oct 2010 13:05:09 +0000 (UTC) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by smtp.gentoo.org (Postfix) with ESMTP id 2B2671B405F for ; Sun, 17 Oct 2010 13:05:07 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1P7Sv9-0005Fr-J7 for gentoo-user@gentoo.org; Sun, 17 Oct 2010 15:05:03 +0200 Received: from athedsl-395228.home.otenet.gr ([79.131.95.218]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 17 Oct 2010 15:05:03 +0200 Received: from realnc by athedsl-395228.home.otenet.gr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 17 Oct 2010 15:05:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: gentoo-user@lists.gentoo.org From: Nikos Chantziaras Subject: [gentoo-user] Re: X programs as root Date: Sun, 17 Oct 2010 16:03:35 +0300 Organization: Lucas Barks Message-ID: References: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: athedsl-395228.home.otenet.gr User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20101014 Thunderbird/3.1.4 In-Reply-To: X-Archives-Salt: 87c6cec1-4c0c-46c6-9aa9-cfc76a4e5342 X-Archives-Hash: ba86f8cffe844fc5d13ab339de641557 On 10/17/2010 04:00 PM, Nikos Chantziaras wrote: > On 09/22/2010 09:48 PM, Andrey Vul wrote: >> When I launch X programs via sudo, I get the following: >> >> $sudo gui-admin >> No protocol specified >> gui-admin: cannot connect to X server :0 >> >> ( Assume gui-admin is an X program ) >> >> But (gk|kde)su(do)? works. This is somewhat confusing. > > I just discovered something. Keeping HOME is not really recommended, > because the programs that run as root will then use your user's > configuration files and sometimes will set 'root' as their owner. As you > can imagine, this is not a good thing. > > It seems what X programs really need is the .Xauthority file of the > current X session. All you have to do is add this line to your ~/.bashrc: > > export XAUTHORITY="$HOME/.Xauthority" > > Then you don't have to configure sudoers to keep the HOME env var. (I have the tendency to press the "Send" button too soon...) Setting XAUTHORITY in the user's .bashrc also means that you don't have to modify /etc/sudoers *in any way*, not even DISPLAY needs to be kept. Setting XAUTHORITY is *all* what is needed.