{"id":893,"date":"2016-02-18T23:47:16","date_gmt":"2016-02-18T21:47:16","guid":{"rendered":"http:\/\/www.netexpertise.eu\/en\/?p=893"},"modified":"2021-10-28T08:12:41","modified_gmt":"2021-10-28T06:12:41","slug":"ssh-default-shell-and-command-history-on-as400","status":"publish","type":"post","link":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html","title":{"rendered":"SSH, Default Shell and Command History on AS400"},"content":{"rendered":"\n<p>QSHELL and PASE on <a href=\"https:\/\/www.netexpertise.eu\/en\/tag\/ibm-i\">IBM i<\/a> are nice tools but remain quite limited with the fixed size 5250 window with no scroll bars. Let&#8217;s see how to make it better with a secure SSH connection and a few tricks.<br>&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Launch SSH Daemon<\/h3>\n\n\n\n<p>Considering <a href=\"\/en\/category\/security\/ssh\">SSH<\/a> is installed on your AS400 ie 5733SC1 (OpenSSH, OpenSSL, zlib) in LICPGM, you can then start the SSH daemon with this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">STRTCPSVR SERVER(*SSHD)<\/code><\/pre>\n\n\n\n<p>&nbsp;<br>There is no autostart option for SSH TCP server.<br>I ended up adding above command to the <a href=\"\/en\/systems\/as400\/modify-qstrup-startup-program.html\">QSTRUP<\/a> program so it starts automatically upon IPL. From now on, you can connect to your AS400 with <a href=\"http:\/\/www.putty.org\">Putty<\/a> that you can download for free.<br>&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">SSH Default Shell<\/h3>\n\n\n\n<p>The default shell on AS400 is bsh which is quite limited, and uncommon on other operating systems. It can be changed in the sshd_config file (located in \/QOpenSys\/QIBM\/UserData\/SC1\/OpenSSH\/openssh-4.7p1\/etc), adding<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">#ibm pase for IBM i shell\nibmpaseforishell \/QOpenSys\/usr\/bin\/ksh<\/code><\/pre>\n\n\n\n<p>as mentioned on <a href=\"http:\/\/www-01.ibm.com\/support\/docview.wss?uid=nas8N1011555\">IBM website<\/a>.<br>&nbsp;<br>ksh is also nice to have so you can have command history in your terminal.<br>&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Command History<\/h3>\n\n\n\n<p>Once ksh is the default shell, you can configure arrow keys to move within command history. No need to type the commands over and over!<br><br>In the user homedir, create a .profile file, which will be loaded every time you ssh to the AS400:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">if [[ $SHELL = \"\/QOpenSys\/usr\/bin\/ksh\" ]]; then\n  set -o emacs\n  alias __A=`echo \"\\020\"`     # up arrow = ^p = back a command\n  alias __B=`echo \"\\016\"`     # down arrow = ^n = down a command\n  alias __C=`echo \"\\006\"`     # right arrow = ^f = forward a character\n  alias __D=`echo \"\\002\"`     # left arrow = ^b = back a character\n  alias __H=`echo \"\\001\"`     # home = ^a = start of line\n  alias __Y=`echo \"\\005\"`     # end = ^e = end of line\nfi<\/code><\/pre>\n\n\n\n<p><br>Now restart the SSH daemon the same way you started it, and reconnect.<br>On the 1st line, we check the shell is ksh since the previous changes apply to SSH connections only. The .profile is also loaded in QSH and PASE (QP2TERM), which don&#8217;t run ksh by default.<br>&nbsp;<br>Connecting with Putty is far more convenient than calling QP2TERM is the 5250 fixed size window!<br>You can even do the same with bash if it has been installed on your system. Hint: Install 5733OPS Option 3, gcc comes along with bash, perl or even rpm on postintallation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>QSHELL and PASE on IBM i are nice tools but remain quite limited with the fixed size 5250 window with no scroll bars. Let&#8217;s see how to make it better with a secure SSH connection and a few tricks.&nbsp; Launch SSH Daemon Considering SSH is installed on your AS400 ie 5733SC1 (OpenSSH, OpenSSL, zlib) in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[210,150],"tags":[396,405,230,273,403,395],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Netexpertise - SSH, Default Shell and Command History on AS400<\/title>\n<meta name=\"description\" content=\"Configure SSH, set ksh or bash as default shells, and benefit from command history on AS400 \/ IBM i platform\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Netexpertise - SSH, Default Shell and Command History on AS400\" \/>\n<meta property=\"og:description\" content=\"Configure SSH, set ksh or bash as default shells, and benefit from command history on AS400 \/ IBM i platform\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html\" \/>\n<meta property=\"og:site_name\" content=\"Netexpertise\" \/>\n<meta property=\"article:published_time\" content=\"2016-02-18T21:47:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-28T06:12:41+00:00\" \/>\n<meta name=\"author\" content=\"dave\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@netexpertise\" \/>\n<meta name=\"twitter:site\" content=\"@netexpertise\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html\",\"url\":\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html\",\"name\":\"Netexpertise - SSH, Default Shell and Command History on AS400\",\"isPartOf\":{\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#website\"},\"datePublished\":\"2016-02-18T21:47:16+00:00\",\"dateModified\":\"2021-10-28T06:12:41+00:00\",\"author\":{\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa\"},\"description\":\"Configure SSH, set ksh or bash as default shells, and benefit from command history on AS400 \/ IBM i platform\",\"breadcrumb\":{\"@id\":\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.netexpertise.eu\/en\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SSH, Default Shell and Command History on AS400\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#website\",\"url\":\"http:\/\/www.netexpertise.eu\/en\/\",\"name\":\"Netexpertise\",\"description\":\"Systems \/ Networks \/ DevOps\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.netexpertise.eu\/en\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa\",\"name\":\"dave\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g\",\"caption\":\"dave\"},\"sameAs\":[\"http:\/\/www.netexpertise.eu\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Netexpertise - SSH, Default Shell and Command History on AS400","description":"Configure SSH, set ksh or bash as default shells, and benefit from command history on AS400 \/ IBM i platform","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":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html","og_locale":"en_US","og_type":"article","og_title":"Netexpertise - SSH, Default Shell and Command History on AS400","og_description":"Configure SSH, set ksh or bash as default shells, and benefit from command history on AS400 \/ IBM i platform","og_url":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html","og_site_name":"Netexpertise","article_published_time":"2016-02-18T21:47:16+00:00","article_modified_time":"2021-10-28T06:12:41+00:00","author":"dave","twitter_card":"summary_large_image","twitter_creator":"@netexpertise","twitter_site":"@netexpertise","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html","url":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html","name":"Netexpertise - SSH, Default Shell and Command History on AS400","isPartOf":{"@id":"http:\/\/www.netexpertise.eu\/en\/#website"},"datePublished":"2016-02-18T21:47:16+00:00","dateModified":"2021-10-28T06:12:41+00:00","author":{"@id":"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa"},"description":"Configure SSH, set ksh or bash as default shells, and benefit from command history on AS400 \/ IBM i platform","breadcrumb":{"@id":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/ssh-default-shell-and-command-history-on-as400.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.netexpertise.eu\/en"},{"@type":"ListItem","position":2,"name":"SSH, Default Shell and Command History on AS400"}]},{"@type":"WebSite","@id":"http:\/\/www.netexpertise.eu\/en\/#website","url":"http:\/\/www.netexpertise.eu\/en\/","name":"Netexpertise","description":"Systems \/ Networks \/ DevOps","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.netexpertise.eu\/en\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa","name":"dave","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g","caption":"dave"},"sameAs":["http:\/\/www.netexpertise.eu"]}]}},"_links":{"self":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts\/893"}],"collection":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/comments?post=893"}],"version-history":[{"count":0,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts\/893\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/media?parent=893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/categories?post=893"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/tags?post=893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}