Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 May 2009 08:41:54 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Pieter Donche <Pieter.Donche@ua.ac.be>
Cc:        "mail.list freebsd-questions" <freebsd-questions@freebsd.org>
Subject:   Re: root user, graphical programs
Message-ID:  <4A0D1CC2.8000107@infracaninophile.co.uk>
In-Reply-To: <alpine.BSF.2.00.0905150843110.83166@macos.cmi.ua.ac.be>
References:  <alpine.BSF.2.00.0905150843110.83166@macos.cmi.ua.ac.be>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig4E12BA1D295ED2DBB43668C3
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

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.
>=20
> What's wrong and how to solve it?

That's the standard X Windows security stopping other users opening windo=
ws
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 .Xauth=
ority
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
 =20
   # xauth remove $DISPLAY

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW


--------------enig4E12BA1D295ED2DBB43668C3
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEAREIAAYFAkoNHMkACgkQ8Mjk52CukIyJnwCdF68h4+nb6WRuOF+sCbeLLZWd
oz8AnAo+qHh0kNAfnfw1RwArrGyIDbhn
=aemP
-----END PGP SIGNATURE-----

--------------enig4E12BA1D295ED2DBB43668C3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A0D1CC2.8000107>