{"id":283,"date":"2025-10-02T17:14:31","date_gmt":"2025-10-02T16:14:31","guid":{"rendered":"https:\/\/blogs.ncl.ac.uk\/helengriffiths\/?p=283"},"modified":"2025-10-03T13:05:14","modified_gmt":"2025-10-03T12:05:14","slug":"xpra-over-ssh-from-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/blogs.ncl.ac.uk\/helengriffiths\/2025\/10\/02\/xpra-over-ssh-from-ubuntu-22-04\/","title":{"rendered":"Xpra over SSH from Ubuntu 22.04"},"content":{"rendered":"\n<p>This tutorial aims to guide you through running several X applications, disconnecting from them whilst they carry on running, and reconnecting to them.  It contains a couple of tweaks to commands that workaround problems that I found when using Xpra on my Ubuntu 22.04 desktop.  I thank the Xpra developer, <a href=\"https:\/\/github.com\/totaam\">Antoine Martin<\/a>, for <a href=\"https:\/\/github.com\/orgs\/Xpra-org\/discussions\/4679\" data-type=\"link\" data-id=\"https:\/\/github.com\/orgs\/Xpra-org\/discussions\/4679\">his assistance<\/a>. <\/p>\n\n\n\n<p>This tutorial assumes that:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You&#8217;ve already installed Xpra from the official sources (not your distro&#8217;s built-in repos) on both the server and your PC.<\/li>\n\n\n\n<li>You can SSH into the server from your PC.<\/li>\n\n\n\n<li>Your server has Xeyes and Xterm installed.<\/li>\n<\/ul>\n\n\n\n<p>If your organisation&#8217;s Cyber Security team allow you to use SSH public keys to login to the server, <code>ssh-copy-id user@server<\/code> will minimise the typing of your password.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Steps<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Starting Xeyes<\/h3>\n\n\n\n<p>1. SSH into the server and type:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xpra seamless --start=xeyes<\/code><\/pre>\n\n\n\n<p>You can&#8217;t see an Xeyes window yet, by design.  Xeyes has started on the server but you don&#8217;t yet have a means of seeing it.  Press enter to get a prompt and then press CTRL-D to logout from the server.<\/p>\n\n\n\n<p>2. On your PC in a terminal window, type:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xpra attach ssh:\/\/user@server<\/code><\/pre>\n\n\n\n<p>Xeyes opens on your screen, even though you logged out of the server. <\/p>\n\n\n\n<p>3. Right-click the Xpra icon in your system tray and choose Disconnect, and Xeyes will close again. <em>Don&#8217;t<\/em> click the &#8220;close&#8221; on the Xeyes window itself. Repeat step 2 to satisfy yourself that Xpra is keeping Xeyes open for you on the server.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Running two X programs at once<\/h3>\n\n\n\n<p>4. SSH back into the server and type:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xpra seamless --start xterm<\/code><\/pre>\n\n\n\n<p>Note that the output includes:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Actual display used: :2<\/pre>\n\n\n\n<p>The number shown may differ for you. Xpra has selected an available virtual display for you automatically.<\/p>\n\n\n\n<p>5. On your PC in a terminal window, type:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xpra attach ssh:\/\/user@server\/<\/code><\/pre>\n\n\n\n<p>No windows open and you see in the terminal output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">there are multiple servers running,<br><br>please specify.<br><br>You can see the list using `xpra list`<\/pre>\n\n\n\n<p>Xpra is helpfully telling you that it doesn&#8217;t know which of the two X applications you want to use. Instead, type:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xpra attach ssh:\/\/user@server\/2<\/code><\/pre>\n\n\n\n<p>Xterm opens on your PC screen.  The &#8220;2&#8221; is the number that was displayed to you when you started Xterm in Xpra.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Listing and ending Xpra sessions<\/h3>\n\n\n\n<p>6. On the server, see all your sessions by typing:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xpra list<\/code><\/pre>\n\n\n\n<p>Note: this doesn&#8217;t tell you what commands the sessions are running. It will, however let you see whether sessions carried on after you finished using a program.<\/p>\n\n\n\n<p>7. To end my Xterm and Xeyes sessions, I type on the server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xpra stop 2\nxpra stop<\/code><\/pre>\n\n\n\n<p>Note that, like <code>xpra attach<\/code>, <code>xpra stop<\/code> needs to be given a virtual display number to act on if there is more than one session running.<\/p>\n\n\n\n<p>If I was still connected to Xterm and Xeyes from my PC, the Xpra clients automatically closed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Hints<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you close the X application using its close button or any other built-in exit feature, the Xpra session carries on running even though the X application is closed. Use <code>xpra stop<\/code> to end the stale session.<\/li>\n\n\n\n<li><code>xpra list<\/code> cannot tell you the name of the application that a given session is running, so when you launch an application, jot down the number of the virtual display it uses.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<p>I spent a lot of time and questioning of <span title=\"Monsieur\" style=\"border-bottom: 1px dashed\">M.<\/span> Martin to find out that the Paramiko libraries seem to read the SSH username from your ~\/.ssh\/config file, even if you give a username in the Xpra command. If you get a modal dialog prompting you for the password for a username@host different from the one you gave on the command line, either pass <code>--ssh=ssh<\/code> to Xpra or edit your ~\/.ssh\/config.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial aims to guide you through running several X applications, disconnecting from them whilst they carry on running, and reconnecting to them. It contains a couple of tweaks to commands that workaround problems that I found when using Xpra on my Ubuntu 22.04 desktop. I thank the Xpra developer, Antoine Martin, for his assistance. &hellip; <a href=\"https:\/\/blogs.ncl.ac.uk\/helengriffiths\/2025\/10\/02\/xpra-over-ssh-from-ubuntu-22-04\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Xpra over SSH from Ubuntu 22.04&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1447,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-283","post","type-post","status-publish","format-standard","hentry","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/blogs.ncl.ac.uk\/helengriffiths\/wp-json\/wp\/v2\/posts\/283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ncl.ac.uk\/helengriffiths\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.ncl.ac.uk\/helengriffiths\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/helengriffiths\/wp-json\/wp\/v2\/users\/1447"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/helengriffiths\/wp-json\/wp\/v2\/comments?post=283"}],"version-history":[{"count":9,"href":"https:\/\/blogs.ncl.ac.uk\/helengriffiths\/wp-json\/wp\/v2\/posts\/283\/revisions"}],"predecessor-version":[{"id":294,"href":"https:\/\/blogs.ncl.ac.uk\/helengriffiths\/wp-json\/wp\/v2\/posts\/283\/revisions\/294"}],"wp:attachment":[{"href":"https:\/\/blogs.ncl.ac.uk\/helengriffiths\/wp-json\/wp\/v2\/media?parent=283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/helengriffiths\/wp-json\/wp\/v2\/categories?post=283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/helengriffiths\/wp-json\/wp\/v2\/tags?post=283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}