{"id":86,"date":"2018-01-24T15:31:44","date_gmt":"2018-01-24T06:31:44","guid":{"rendered":"http:\/\/blog.peddals.com\/?p=86"},"modified":"2023-04-16T22:21:18","modified_gmt":"2023-04-16T13:21:18","slug":"pythonista3_ssh_to_xserver","status":"publish","type":"post","link":"https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/","title":{"rendered":"iOS Pythonista 3: Using SSH"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Use SSH in Pythonista 3 (StaSh)<\/h1>\n\n\n\n<p>SSH in StaSh seems not to work if a passphrase is given to create keys. I found some hosting servers do not accept passphrase (password) to connect using SSH. In this post you can find a way to careate SSH keys in Pythonista 3 (SSH command in StaSh) with no passphrase.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Generate SSH keys in StaSh<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">$ ssh-keygen -t rsa -b 2048<\/pre>\n\n\n\n<p>Secret key and Public key are generated in the following path.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">~\/Documents\/site-packages\/stash\/.ssh\n$ ls\nid_rsa id_rsa.pub<\/pre>\n\n\n\n<p>Copy the public key &#8220;id_rsa.pub&#8221; to your SSH server&#8217;s appropriate location.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SSH command to connect to your server<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">$ ssh username@username.xsrv.jp -p 10022<\/pre>\n\n\n\n<p>Above is an example to connect to XServer hosting server that I use. Change <i>username<\/i>, host name (&#8220;<i>username.xsrv.jp<\/i>&#8221; in this example) and port number (<i>10022<\/i> in this case).<\/p>\n\n\n\n<p>When you first run the <code>ssh<\/code> command in Pythonista 3, a terminal emulator &#8220;pyte&#8221; will be installed automatically. In this case you&#8217;ll see <code>global name 'pyte' is not defined<\/code> error message and need to quit and relaunch Pythonista 3.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Additional Notes &#8211; Set number of lines<\/h2>\n\n\n\n<p>Once the above is complete, you will want to add an alias (shortcut command) to the <code>.stashrc<\/code> file (<a href=\"http:\/\/blog.peddals.com\/en\/install_py-tree_on_pythonista3\/#alias\">Reference<\/a>), copy the SSH keys to another SSH app, iOS device or computer. <b>Make sure that you do not share &#8220;ids_rsa&#8221; the secret key file with anyone.<\/b> Create <code>.ssh<\/code> folder in the same path if you use Pythonista 3 in another iOS device and place the ids_rsa file.<\/p>\n\n\n\n<p>When connecting to a host, you will notice at least 3 lines from the top will be hidden as StaSh&#8217;s shortcut keys and iOS&#8217;s software keyboard will use 3 lines of the bottom of your screen. This is very annoying especially when you use &#8216;vi&#8217; command to edit a file. To avoid this issue, one manual way is to use &#8220;<code>stty<\/code>&#8221; command to set your screen size (number of rows) every time you SSH to a server. Refer to examples below and find the best number for your environment.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ stty rows 51 # Works best for iPad mini 2 + Bluetooth keyboard\n$ stty rows 27 # Works best for iPhone 8 Plus with iOS software keyboard<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Use SSH in Pythonista 3 (StaSh) SSH in StaSh seems not to work if a passphrase is given to create keys. I foun &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;iOS Pythonista 3: Using SSH&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"73","footnotes":""},"categories":[7,4,5],"tags":[],"class_list":["post-86","post","type-post","status-publish","format-standard","hentry","category-ios","category-python","category-pythonista3","en-US"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>iOS Pythonista 3: Using SSH | Peddals Blog<\/title>\n<meta name=\"description\" content=\"Pythonista 3 app for iOS \u3092\u4f7f\u3063\u3066\u3001\u30db\u30b9\u30c6\u30a3\u30f3\u30b0\u30b5\u30fc\u30d0 XServer \u3078 SSH \u63a5\u7d9a\u3059\u308b\u65b9\u6cd5\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"iOS Pythonista 3: Using SSH | Peddals Blog\" \/>\n<meta property=\"og:description\" content=\"Pythonista 3 app for iOS \u3092\u4f7f\u3063\u3066\u3001\u30db\u30b9\u30c6\u30a3\u30f3\u30b0\u30b5\u30fc\u30d0 XServer \u3078 SSH \u63a5\u7d9a\u3059\u308b\u65b9\u6cd5\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/\" \/>\n<meta property=\"og:site_name\" content=\"Peddals Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-24T06:31:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-16T13:21:18+00:00\" \/>\n<meta name=\"author\" content=\"Handsome\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Handsome\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/pythonista3_ssh_to_xserver\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/pythonista3_ssh_to_xserver\\\/\"},\"author\":{\"name\":\"Handsome\",\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/#\\\/schema\\\/person\\\/81b2dabca748c3d11a45722f02d9d994\"},\"headline\":\"iOS Pythonista 3: Using SSH\",\"datePublished\":\"2018-01-24T06:31:44+00:00\",\"dateModified\":\"2023-04-16T13:21:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/pythonista3_ssh_to_xserver\\\/\"},\"wordCount\":316,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/#\\\/schema\\\/person\\\/81b2dabca748c3d11a45722f02d9d994\"},\"articleSection\":[\"iOS\",\"Python\",\"Pythonista3\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/blog.peddals.com\\\/en\\\/pythonista3_ssh_to_xserver\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/pythonista3_ssh_to_xserver\\\/\",\"url\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/pythonista3_ssh_to_xserver\\\/\",\"name\":\"iOS Pythonista 3: Using SSH | Peddals Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/#website\"},\"datePublished\":\"2018-01-24T06:31:44+00:00\",\"dateModified\":\"2023-04-16T13:21:18+00:00\",\"description\":\"Pythonista 3 app for iOS \u3092\u4f7f\u3063\u3066\u3001\u30db\u30b9\u30c6\u30a3\u30f3\u30b0\u30b5\u30fc\u30d0 XServer \u3078 SSH \u63a5\u7d9a\u3059\u308b\u65b9\u6cd5\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/pythonista3_ssh_to_xserver\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.peddals.com\\\/en\\\/pythonista3_ssh_to_xserver\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/en\\\/pythonista3_ssh_to_xserver\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u30db\u30fc\u30e0\",\"item\":\"https:\\\/\\\/blog.peddals.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"iOS Pythonista 3: Using SSH\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/#website\",\"url\":\"https:\\\/\\\/blog.peddals.com\\\/\",\"name\":\"Peddals Blog\",\"description\":\"AI, LLM, Python, Mac, Pythonista3, iOS, etc. in Japanese and English\",\"publisher\":{\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/#\\\/schema\\\/person\\\/81b2dabca748c3d11a45722f02d9d994\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.peddals.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/blog.peddals.com\\\/#\\\/schema\\\/person\\\/81b2dabca748c3d11a45722f02d9d994\",\"name\":\"Handsome\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g\",\"caption\":\"Handsome\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"iOS Pythonista 3: Using SSH | Peddals Blog","description":"Pythonista 3 app for iOS \u3092\u4f7f\u3063\u3066\u3001\u30db\u30b9\u30c6\u30a3\u30f3\u30b0\u30b5\u30fc\u30d0 XServer \u3078 SSH \u63a5\u7d9a\u3059\u308b\u65b9\u6cd5","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/","og_locale":"en_US","og_type":"article","og_title":"iOS Pythonista 3: Using SSH | Peddals Blog","og_description":"Pythonista 3 app for iOS \u3092\u4f7f\u3063\u3066\u3001\u30db\u30b9\u30c6\u30a3\u30f3\u30b0\u30b5\u30fc\u30d0 XServer \u3078 SSH \u63a5\u7d9a\u3059\u308b\u65b9\u6cd5","og_url":"https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/","og_site_name":"Peddals Blog","article_published_time":"2018-01-24T06:31:44+00:00","article_modified_time":"2023-04-16T13:21:18+00:00","author":"Handsome","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Handsome","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/#article","isPartOf":{"@id":"https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/"},"author":{"name":"Handsome","@id":"https:\/\/blog.peddals.com\/#\/schema\/person\/81b2dabca748c3d11a45722f02d9d994"},"headline":"iOS Pythonista 3: Using SSH","datePublished":"2018-01-24T06:31:44+00:00","dateModified":"2023-04-16T13:21:18+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/"},"wordCount":316,"commentCount":0,"publisher":{"@id":"https:\/\/blog.peddals.com\/#\/schema\/person\/81b2dabca748c3d11a45722f02d9d994"},"articleSection":["iOS","Python","Pythonista3"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/","url":"https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/","name":"iOS Pythonista 3: Using SSH | Peddals Blog","isPartOf":{"@id":"https:\/\/blog.peddals.com\/#website"},"datePublished":"2018-01-24T06:31:44+00:00","dateModified":"2023-04-16T13:21:18+00:00","description":"Pythonista 3 app for iOS \u3092\u4f7f\u3063\u3066\u3001\u30db\u30b9\u30c6\u30a3\u30f3\u30b0\u30b5\u30fc\u30d0 XServer \u3078 SSH \u63a5\u7d9a\u3059\u308b\u65b9\u6cd5","breadcrumb":{"@id":"https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.peddals.com\/en\/pythonista3_ssh_to_xserver\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u30db\u30fc\u30e0","item":"https:\/\/blog.peddals.com\/"},{"@type":"ListItem","position":2,"name":"iOS Pythonista 3: Using SSH"}]},{"@type":"WebSite","@id":"https:\/\/blog.peddals.com\/#website","url":"https:\/\/blog.peddals.com\/","name":"Peddals Blog","description":"AI, LLM, Python, Mac, Pythonista3, iOS, etc. in Japanese and English","publisher":{"@id":"https:\/\/blog.peddals.com\/#\/schema\/person\/81b2dabca748c3d11a45722f02d9d994"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.peddals.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/blog.peddals.com\/#\/schema\/person\/81b2dabca748c3d11a45722f02d9d994","name":"Handsome","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g","caption":"Handsome"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/51d7363349ec538c4d62c9ebe89488fd7388729ad0c9dfeebd8bb32ebfb11f17?s=96&d=mm&r=g"}}]}},"_links":{"self":[{"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/posts\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":3,"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"predecessor-version":[{"id":276,"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/posts\/86\/revisions\/276"}],"wp:attachment":[{"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.peddals.com\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}