{"id":906,"date":"2013-11-24T21:18:35","date_gmt":"2013-11-24T21:18:35","guid":{"rendered":"http:\/\/scunster.co.uk\/?p=906"},"modified":"2013-11-24T21:19:21","modified_gmt":"2013-11-24T21:19:21","slug":"email-alerts-whenever-someone-logs-into-root-via-ssh","status":"publish","type":"post","link":"https:\/\/scunster.co.uk\/?p=906","title":{"rendered":"Email alerts whenever someone logs into root via SSH"},"content":{"rendered":"<p>If you&#8217;d like to be notified by email every time someone logs into your server via ssh do the following<\/p>\n<p>Go to the  \/root directory and edit .bashrc<\/p>\n<p>Towards the bottom of the file add the following<\/p>\n<p><code>echo 'ALERT - Root Shell Access (YourServerName) on:' `date` `who` | mail -s \"Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`\" you@yourdomain.com<\/code><\/p>\n<p>Change (YourServerName) for the name you&#8217;d like to identify your server<br \/>\nChange you@yourdomain.com to the email address you want the notification to go to<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;d like to be notified by email every time someone logs into your server via ssh do the following Go to the \/root directory and edit .bashrc Towards the bottom of the file add the following echo &#8216;ALERT &#8211; Root Shell Access (YourServerName) on:&#8217; `date` `who` | mail -s &#8220;Alert: Root Access from `who [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,171],"tags":[],"class_list":["post-906","post","type-post","status-publish","format-standard","hentry","category-linux","category-security-linux"],"_links":{"self":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/906","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=906"}],"version-history":[{"count":1,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/906\/revisions"}],"predecessor-version":[{"id":907,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/906\/revisions\/907"}],"wp:attachment":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=906"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=906"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}