<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://t2bwiki.iihe.ac.be/index.php?action=history&amp;feed=atom&amp;title=TunnelSSHThroughSu</id>
	<title>TunnelSSHThroughSu - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://t2bwiki.iihe.ac.be/index.php?action=history&amp;feed=atom&amp;title=TunnelSSHThroughSu"/>
	<link rel="alternate" type="text/html" href="https://t2bwiki.iihe.ac.be/index.php?title=TunnelSSHThroughSu&amp;action=history"/>
	<updated>2026-04-20T22:33:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://t2bwiki.iihe.ac.be/index.php?title=TunnelSSHThroughSu&amp;diff=336&amp;oldid=prev</id>
		<title>Maintenance script: Created page with &quot; How to tunnel ssh display through su on fedora:&lt;br&gt; When you su through root like that and then to another (non-root) user you need to copy root&#039;s xauthorization first (this...&quot;</title>
		<link rel="alternate" type="text/html" href="https://t2bwiki.iihe.ac.be/index.php?title=TunnelSSHThroughSu&amp;diff=336&amp;oldid=prev"/>
		<updated>2015-08-26T12:29:24Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; How to tunnel ssh display through su on fedora:&amp;lt;br&amp;gt; When you su through root like that and then to another (non-root) user you need to copy root&amp;#039;s xauthorization first (this...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
How to tunnel ssh display through su on fedora:&amp;lt;br&amp;gt;&lt;br /&gt;
When you su through root like that and then to another (non-root) user you need to copy root&amp;#039;s xauthorization first (this is regardless of whether you are in an ssh session or not)&amp;lt;br&amp;gt;&lt;br /&gt;
so, while you are still root type &amp;#039;xauth list&amp;#039; to get the cookie, and copy the whole line by highlighting it, then su to the other user and use &amp;#039;xauth add&amp;#039; to add the authorization&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[root@linux1 ~]# xauth list&lt;br /&gt;
linux1/unix:10  MIT-MAGIC-COOKIE-1  6a84e4f2561f9b25858f7e2e4b969d60&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su - user1&lt;br /&gt;
xauth add linux1/unix:10  MIT-MAGIC-COOKIE-1  6a84e4f2561f9b25858f7e2e4b969d60&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
alternate solution:&amp;lt;br&amp;gt;&lt;br /&gt;
You can either use the xauthority of the original ssh user or root&amp;#039;s, probably best to do it your way. Note that if you don&amp;#039;t go through root then this isn&amp;#039;t required eg&lt;br /&gt;
&lt;br /&gt;
ssh -X -l user1 &amp;lt;server&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
su - user2&amp;lt;br&amp;gt;&lt;br /&gt;
su - user3&amp;lt;br&amp;gt;&lt;br /&gt;
su - user4&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then xapps work fine for user4, the authority is propagated through the chain of logins. Once you switch user to root the chain is broken and you must manually create the xauthority.&lt;br /&gt;
&lt;br /&gt;
EDIT&lt;br /&gt;
This behaviour is controlled by pam_xauth, and apparently you can make it automatic for root to forward the xauth key to a user by creating a file /root/.xauth/export and adding the allowed users to it, see http://www.kernel.org/pub/linux/libs...pam_xauth.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{TracNotice|{{PAGENAME}}}}&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>