{"id":407,"date":"2017-06-24T13:43:08","date_gmt":"2017-06-24T12:43:08","guid":{"rendered":"http:\/\/chewett.co.uk\/blog\/?p=407"},"modified":"2017-06-19T23:30:29","modified_gmt":"2017-06-19T22:30:29","slug":"ssh-connect-host-raspberrypi-port-22-connection-refused-error-fixed","status":"publish","type":"post","link":"https:\/\/chewett.co.uk\/blog\/407\/ssh-connect-host-raspberrypi-port-22-connection-refused-error-fixed\/","title":{"rendered":"ssh: connect to host raspberrypi port 22: Connection refused Error Fixed"},"content":{"rendered":"<p>I was setting up a new install of Raspbian Pixel and found I couldn&#8217;t login to the Raspberry Pi. It was giving me an error:<\/p>\n<pre>chewett@bunker-master:~$ ssh pi@raspberrypi\r\nssh: connect to host raspberrypi port 22: Connection refused<\/pre>\n<p>It turns out that recently the Raspberry Pi Foundation have changed the default setting for SSH and disabled it by default. Below are two ways to enable this useful feature.<\/p>\n<p><strong>Please remember that if you are enabling SSH you should also change the default password of the Raspberry Pi from <code>raspberry<\/code>. This can be done by running <code>passwd<\/code>\u00a0as the <code>pi<\/code>\u00a0user.<\/strong><\/p>\n<h2>How to enable SSH for Raspberry Pi<\/h2>\n<p>There are two ways to enable SSH. If you are able to \u00a0connect your Raspberry Pi to a monitor and attach a keyboard and mouse you should follow the first steps. If you are unable to do this easily then I suggest using the second step.<\/p>\n<h3>Enabling SSH via the GUI<\/h3>\n<p>To enable SSH via the GUI you will need to attach your Raspberry Pi to a monitor, keyboard and mouse. Once this has been done you should open a console and run<\/p>\n<pre>sudo raspi-config<\/pre>\n<p>Once in the config editing screen you can use your keyboard to enter <code>interfacing options<\/code>\u00a0then <code>SSH<\/code>. Here you are now able to enable SSH.<\/p>\n<p>Once this has been done SSH will be accessible on your Raspberry Pi and you should not get the above error.<\/p>\n<h3>Enabling SSH by adding a file to the memory Card<\/h3>\n<p>If you are unable to connect your Pi to a monitor you can enable it using a file. To do this put your Raspberry Pi memory card in your computer and open its first partition. You should put a file called <code>ssh<\/code>\u00a0in the boot partitionof the memory card. When the Raspberry Pi turns on it will enable SSH if this file exists, then delete the file. This will then let you SSH into your Raspberry Pi.<\/p>\n<h2>Why was SSH disabled?<\/h2>\n<p>There has been recent concern that Internet of Things devices are being used to create large botnet. This is partially down to the fact many use default passwords and some of these cannot be changed. Therefore the Raspberry Pi Foundation changed their default setting to disable SSH by default.<\/p>\n<p>Hopefully this will help other users trying to access their Raspberry Pi by SSH.<\/p>\n<p>Full details are written in a <a href=\"https:\/\/www.raspberrypi.org\/blog\/a-security-update-for-raspbian-pixel\/\">blogpost<\/a> written by the Raspberry Pi Foundation.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was setting up a new install of Raspbian Pixel and found I couldn&#8217;t login to the Raspberry Pi. It was giving me an error: chewett@bunker-master:~$ ssh pi@raspberrypi ssh: connect to host raspberrypi port 22: Connection refused It turns out that recently the Raspberry Pi Foundation have changed the default setting for SSH and disabled [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[122],"tags":[],"class_list":["post-407","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi-cluster"],"wppr_data":{"cwp_meta_box_check":"No"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2toWX-6z","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":409,"url":"https:\/\/chewett.co.uk\/blog\/409\/setting-raspberry-pi-cluster-node\/","url_meta":{"origin":407,"position":0},"title":"Setting up a Raspberry Pi Cluster Node","author":"Chewett","date":"August 19, 2017","format":false,"excerpt":"To set up a Raspberry Pi node I will follow a specific set of steps so that every Pi is set up \u00a0similarly. For the initial deployment I will follow this once and then clone the SD Card multiple times. If at a later date more are added I will\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":241,"url":"https:\/\/chewett.co.uk\/blog\/241\/installing-raspbian-onto-raspberry-pi\/","url_meta":{"origin":407,"position":1},"title":"Installing Raspbian onto a Raspberry Pi","author":"Chewett","date":"May 17, 2017","format":false,"excerpt":"Here I suggest some recommended steps to install Raspbian on top of their install guide. Choosing an OS for the Raspberry Pi One of the main ways to install a Raspberry Pi OS is to download a disk image called NOOBS.\u00a0This lets you\u00a0choose to easily install a number of different\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":103,"url":"https:\/\/chewett.co.uk\/blog\/103\/irc-client-on-raspberry-pi-screen-and-irssi\/","url_meta":{"origin":407,"position":2},"title":"IRC client on Raspberry Pi &#8211; Screen and irssi","author":"Chewett","date":"February 20, 2013","format":false,"excerpt":"A IRC client lets you connect to\u00a0a IRC server enabling you to join chatrooms on that server. IRC servers do not by default store logs while you are not logged in. This can be annoying if you wish to keep informed of whats going in on the chatroom. One solution\u2026","rel":"","context":"In &quot;Software&quot;","block_context":{"text":"Software","link":"https:\/\/chewett.co.uk\/blog\/category\/software\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":461,"url":"https:\/\/chewett.co.uk\/blog\/461\/updating-raspberry-pi-cluster-without-logging-every-pi\/","url_meta":{"origin":407,"position":3},"title":"Updating the Raspberry Pi Cluster without logging in to every Pi","author":"Chewett","date":"July 1, 2017","format":false,"excerpt":"The Raspberry Pi foundation have recently updated their Raspbian image. This brings bugfixes and upgrades to the Raspberry Pi. In this blogpost I share how you can run a command on your Raspberry Pi without logging in (this is mostly true although you still do \"log in\" just not in\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/07\/raspbian_update_command.png?fit=580%2C307&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/07\/raspbian_update_command.png?fit=580%2C307&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/07\/raspbian_update_command.png?fit=580%2C307&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":375,"url":"https:\/\/chewett.co.uk\/blog\/375\/setting-up-the-ci20-for-the-cluster\/","url_meta":{"origin":407,"position":4},"title":"Setting up the CI20 for the cluster","author":"Chewett","date":"October 27, 2018","format":false,"excerpt":"This post talks about the steps I have followed to set up my Creator CI20 for the Raspberry Pi Cluster. Burning Debian to the onboard NAND and configuring it To run the CI20 on the Raspberry Pi Cluster I am going to write Debian 8 to the NAND storage. First\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/ci40_setup.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/ci40_setup.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/ci40_setup.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/ci40_setup.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":448,"url":"https:\/\/chewett.co.uk\/blog\/448\/testing-performance-raspberry-pi\/","url_meta":{"origin":407,"position":5},"title":"Testing the performance of a Raspberry Pi","author":"Chewett","date":"July 12, 2017","format":false,"excerpt":"I will be testing the performance of each Raspberry Pi version in my cluster. This is to determine what each one is best suited to running. To do this I need a similar set of tests to run for each and compare them. Ideally the tests will also be runnable\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=407"}],"version-history":[{"count":3,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/407\/revisions"}],"predecessor-version":[{"id":429,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/407\/revisions\/429"}],"wp:attachment":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}