{"id":802,"date":"2012-11-19T15:13:07","date_gmt":"2012-11-19T15:13:07","guid":{"rendered":"http:\/\/www.omniweb.com\/wordpress\/?p=802"},"modified":"2012-11-19T15:16:45","modified_gmt":"2012-11-19T15:16:45","slug":"receive-alerts-when-someone-connects-with-ssh","status":"publish","type":"post","link":"https:\/\/www.omniweb.com\/wordpress\/?p=802","title":{"rendered":"Receive Alerts when someone connects with SSH"},"content":{"rendered":"<p>We needed to set up alerts whenever someone connects to a particular server.  Since the server only has one user that can SSH (root is disallowed) it was pretty <a href=\"http:\/\/blog.hostonnet.com\/e-mail-alert-on-root-ssh-login\">easy to follow these instructions<\/a> and have it working in 5 minutes:<\/p>\n<p>Add following content to .bashrc file of the SSH user<\/p>\n<p><code>echo 'ALERT - ServerName Root Access on:' `date` `who` | mail -s \"Alert: ServerName Access from `who | cut -d'(' -f2 | cut -d')' -f1`\" you@yourdomain.com<\/code><\/p>\n<p>changed ServerName to the actual servername (in 2 places),<br \/>\nchanged Root to the actual user who has SSH access (and whose .bashrc was updated)<br \/>\nchanged you@yourdomain to my own email.<\/p>\n<p>Conceivably this could be done to every user&#8217;s .bashrc file and (assuming you trust them not to change it)  you&#8217;d always be notified when they log in.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We needed to set up alerts whenever someone connects to a particular server. Since the server only has one user that can SSH (root is disallowed) it was pretty easy to follow these instructions and have it working in 5 &hellip; <a href=\"https:\/\/www.omniweb.com\/wordpress\/?p=802\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/802"}],"collection":[{"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=802"}],"version-history":[{"count":4,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/802\/revisions"}],"predecessor-version":[{"id":808,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/802\/revisions\/808"}],"wp:attachment":[{"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}