{"id":246,"date":"2007-10-09T11:36:14","date_gmt":"2007-10-09T17:36:14","guid":{"rendered":"http:\/\/blog.the-erm.com\/archives\/246"},"modified":"2007-10-09T11:36:14","modified_gmt":"2007-10-09T17:36:14","slug":"if-youre-going-to-run-an-ssh-server","status":"publish","type":"post","link":"https:\/\/blog.the-erm.com\/?p=246","title":{"rendered":"If you&#8217;re going to run an ssh server"},"content":{"rendered":"<p>Before you think about running an ssh server, you should also do the following.<br \/>\n<!--more--><br \/>\nSecurity is important, and keeping the bad people out, and letting the good people in is what it&#8217;s all about.<\/p>\n<p>Ssh is a great program, it allows you to log in to your computer anywhere in the world secure, and encrypted.<\/p>\n<p>Let&#8217;s start with installing, if you&#8217;re running x\/k\/ed\/ubuntu<br \/>\n<code><br \/>\nsudo apt-get install openssh-client openssh-serversudo apt-get install openssh-client openssh-server<\/code><\/p>\n<p>Next edit \/etc\/sshd_config<br \/>\nFind this line, and make sure it says no.<br \/>\nPermitRootLogin no<\/p>\n<p>The reason you don&#8217;t want to allow root to log in remotely is it&#8217;s a common username if anyone does a brute force\/dictionary attack on your server they will probably use the username root.<\/p>\n<p>The good news is you can easily log in as root if you&#8217;re logged in via ssh.<\/p>\n<p><code><br \/>\nuser@localhost $ ssh user@remote-host-or-ip<br \/>\nPassword:<br \/>\nuser@remote-host-or-ip $ su<br \/>\nPassword:<br \/>\nroot@remote-host-or-ip$ <run commands as root><br \/>\n<\/run><\/code><\/p>\n<p>Or next step is to block all the bad guys from even being able to access your site.<br \/>\n<a href=\"http:\/\/denyhosts.sourceforge.net\/\">Denyhosts<\/a> is the way to go.<\/p>\n<p>The cool thing about denyhosts is if someone is running a brute force attack on your ssh server, and they get the password wrong X amount of times it blocks that ip from accessing your ssh server, or if you prefer everything.<\/p>\n<p>Another REALLY cool thing about denyhosts is the database.  You can set up denyhosts to connect to a remote database, and get all the attacking ip addresses out there, so they don&#8217;t even have to attempt to connect to your machine, and you can block any potential threats.<\/p>\n<p>The bottom line is if you are running an ssh server that is accessible from the net, then you should be running denyhosts.<\/p>\n<p>That&#8217;s all I really have to say on the subject.<\/p>\n<p>Erm<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Before you think about running an ssh server, you should also do the following.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,8],"tags":[],"class_list":["post-246","post","type-post","status-publish","format-standard","hentry","category-linux-2","category-tech"],"_links":{"self":[{"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/posts\/246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=246"}],"version-history":[{"count":0,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/posts\/246\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}