{"id":184,"date":"2011-03-29T22:11:59","date_gmt":"2011-03-30T03:11:59","guid":{"rendered":"http:\/\/www.popmartian.com\/tipsntricks\/?p=184"},"modified":"2013-10-21T10:03:30","modified_gmt":"2013-10-21T15:03:30","slug":"how-to-prevent-a-perl-script-from-running-as-root","status":"publish","type":"post","link":"https:\/\/www.popmartian.com\/tipsntricks\/2011\/03\/29\/how-to-prevent-a-perl-script-from-running-as-root\/","title":{"rendered":"How To Prevent A PERL Script From Running As Root"},"content":{"rendered":"<p>At or near the top of your app, before it executes anything sensitive, place the following code:<\/p>\n<p><code>if((getpwuid($<) eq \"root\") || ($< == 0)){\n    print STDOUT \"Cannot run as root!\\n\";\n    exit(1);\n}<\/code><\/p>\n<p>How to do this in Python: <a href=\"http:\/\/www.popmartian.com\/tipsntricks\/2013\/10\/21\/how-to-prevent-a-python-script-from-running-as-root\/\" title=\"...how-to-prevent-a-python-script-from-running-as-root...\">how-to-prevent-a-python-script-from-running-as-root<\/a><\/p>\n<blockquote><p>Did you find this post useful or have questions or comments?  Please let  me know!<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>At or near the top of your app, before it executes anything sensitive, place the following code: if((getpwuid($<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,12,9],"tags":[],"class_list":["post-184","post","type-post","status-publish","format-standard","hentry","category-how-to-do-stuff","category-perl","category-programming"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/posts\/184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/comments?post=184"}],"version-history":[{"count":6,"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/posts\/184\/revisions"}],"predecessor-version":[{"id":264,"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/posts\/184\/revisions\/264"}],"wp:attachment":[{"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/media?parent=184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/categories?post=184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.popmartian.com\/tipsntricks\/wp-json\/wp\/v2\/tags?post=184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}