{"id":1412,"date":"2015-11-03T14:35:49","date_gmt":"2015-11-03T19:35:49","guid":{"rendered":"http:\/\/www.familytidings.com\/blog\/?p=1412"},"modified":"2015-11-03T14:37:00","modified_gmt":"2015-11-03T19:37:00","slug":"ssh-x-forwarding-when-using-sudo","status":"publish","type":"post","link":"https:\/\/www.familytidings.com\/blog\/?p=1412","title":{"rendered":"SSH X Forwarding when using Sudo"},"content":{"rendered":"<p>When you ssh -X to a host, SSH handles X forwarding for you. However, if you run a sudo command in that session, the process breaks down. Here&#8217;s how you can make it work:<\/p>\n<pre style=\"padding-left: 30px;\">you@local$ ssh -XC server<\/pre>\n<pre style=\"padding-left: 30px;\">you@server$ xauth list\r\n [output]<\/pre>\n<pre style=\"padding-left: 30px;\">you@server$ sudo su - otheruser<\/pre>\n<pre style=\"padding-left: 30px;\">otheruser@server$ xauth add [paste output from \"xauth list\"]<\/pre>\n<pre style=\"padding-left: 30px;\">otheruser@server$ xterm (or other X application)<\/pre>\n<p>Source: <a href=\"http:\/\/backdrift.org\/x-forwarding-sudo-ssh-session\">http:\/\/backdrift.org\/x-forwarding-sudo-ssh-session<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you ssh -X to a host, SSH handles X forwarding for you. However, if you run a sudo command in that session, the process breaks down. Here&#8217;s how you can make it work: you@local$ ssh -XC server you@server$ xauth list [output] you@server$ sudo su &#8211; otheruser otheruser@server$ xauth add [paste output from &#8220;xauth list&#8221;] [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1412","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1412"}],"version-history":[{"count":4,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1412\/revisions"}],"predecessor-version":[{"id":1422,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1412\/revisions\/1422"}],"wp:attachment":[{"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}