From owner-freebsd-questions@FreeBSD.ORG Fri May 15 08:38:41 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C871B106566C for ; Fri, 15 May 2009 08:38:41 +0000 (UTC) (envelope-from Pieter.Donche@ua.ac.be) Received: from macos.cmi.ua.ac.be (macos.cmi.ua.ac.be [143.129.75.1]) by mx1.freebsd.org (Postfix) with ESMTP id 4560C8FC0A for ; Fri, 15 May 2009 08:38:35 +0000 (UTC) (envelope-from Pieter.Donche@ua.ac.be) Received: from macos.cmi.ua.ac.be (localhost [127.0.0.1]) by macos.cmi.ua.ac.be (8.14.2/8.14.2) with ESMTP id n4F8cYJ7085929; Fri, 15 May 2009 10:38:34 +0200 (CEST) (envelope-from Pieter.Donche@ua.ac.be) Received: from localhost (pdon@localhost) by macos.cmi.ua.ac.be (8.14.2/8.14.2/Submit) with ESMTP id n4F8cYe5085926; Fri, 15 May 2009 10:38:34 +0200 (CEST) (envelope-from Pieter.Donche@ua.ac.be) X-Authentication-Warning: macos.cmi.ua.ac.be: pdon owned process doing -bs Date: Fri, 15 May 2009 10:38:34 +0200 (CEST) From: Pieter Donche X-X-Sender: pdon@macos.cmi.ua.ac.be To: Matthew Seaman In-Reply-To: <4A0D1CC2.8000107@infracaninophile.co.uk> Message-ID: References: <4A0D1CC2.8000107@infracaninophile.co.uk> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: "mail.list freebsd-questions" Subject: Re: root user, graphical programs X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Pieter Donche List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 08:38:42 -0000 No luck (yet) I tried both methods, (with xpdf as a graphical program) The first still gives # xpdf Can't open display The second method # xpdf No protocol specified Error: Can't open display: :0.0 (after su -, $HOME was indeed /root) (in /root .Xauthority was changed/created, $DISPLAY is :0.0) On Fri, 15 May 2009, Matthew Seaman wrote: > Pieter Donche wrote: >> FreeBSD 7, KDE 3.5 >> To install Matlab (in linux compat mode), one must execute the >> matlab install program as root. The installer is graphical. >> When from a KDE terminal window, I switch to root (# su -) >> and try a graphical program, e.g. # xpdf, I get Can't open display. >> The FreeBSD handbook (10.5.1) says in that case type setenv HOME ~USER >> (USER the username where the su command was given). This doesn't help >> I still get Can't open display. >> >> What's wrong and how to solve it? > > That's the standard X Windows security stopping other users opening windows > on your screen. In this case, something like: > > % xhost +LOCAL: > % su > # {...whatever you need to do to install your app...} > # exit > % xhost -LOCAL: > > However be aware of the risks: xhost +LOCAL: means that any other user > of the same machine can access your display and potentially capture any > input including (for instance) the root password. > > Hmmm... Actually, a more secure means of doing the same thing, that only > grants access to your display by the local root user would be: > > % xauth extract - $DISPLAY > ~/authtoken > % su - > # echo $HOME > > (This should return /root -- this is important so that the correct > .Xauthority > file gets updated.) > > # xauth merge /home/your-uid/authtoken > # rm /home/your-uid/authtoken > # setenv DISPLAY :0.0 > # {...whatever you need to do to install your app...} > > Now any X programs run by root will open on your display. To revoke this > permission you can simply remove /root/.Xauthority or for finer grained > control you can use > # xauth remove $DISPLAY > > Cheers, > > Matthew > > -- > Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard > Flat 3 > PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate > Kent, CT11 9PW > >