{"id":4907,"date":"2014-09-07T21:18:52","date_gmt":"2014-09-08T04:18:52","guid":{"rendered":"http:\/\/g-liu.com\/blog\/?p=4907"},"modified":"2017-07-22T20:05:12","modified_gmt":"2017-07-23T03:05:12","slug":"ithemes-security-auto-away-lock-out-fix","status":"publish","type":"post","link":"https:\/\/g-liu.com\/blog\/2014\/09\/ithemes-security-auto-away-lock-out-fix\/","title":{"rendered":"Locked yourself out with iThemes Security\/Better WP Security Auto Away? No problem!"},"content":{"rendered":"<p>A couple months ago, I got the <a href=\"https:\/\/wordpress.org\/plugins\/better-wp-security\/\" target=\"_blank\" rel=\"noopener\">iThemes Security WordPress plugin<\/a> and set the <a href=\"http:\/\/ithemes.com\/tutorials\/getting-started-ithemes-security-part-4-away-mode\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"broken_link\">auto-away mode<\/a> from 12:00am to 6:00am. After all, I&#8217;m asleep at those times and it would make no sense to keep my admin login and backend open at these times. Or so I thought. There were nights where I would stay up late, and just recently on my <a title=\"Greetings from China!\" href=\"http:\/\/g-liu.com\/blog\/2014\/08\/greetings-from-china\/\" target=\"_blank\" rel=\"noopener\">trip to China<\/a>, I was locked out in the middle of the local time of day!<\/p>\n<p>In this situation, it&#8217;s not possible to unlock yourself by going to your WordPress admin,\u00a0because it&#8217;s locked down. You&#8217;ll have to dig into your site&#8217;s files, via an FTP client or SSH. When you get to the plugin&#8217;s files, one line of code will disable the auto-away lockout until you can change the settings.<br \/>\n<!--more--><\/p>\n<h1>What you will need<\/h1>\n<ul>\n<li>An FTP or SSH Client\n<ul>\n<li><strong>Preferred<\/strong>: an FTP client. I will demonstrate using the ever-popular <a href=\"http:\/\/filezilla-project.org\" target=\"_blank\" rel=\"noopener\">FileZilla<\/a>.<\/li>\n<li><strong>Alternate<\/strong>: (for experts only). Command-line SSH access. Must have a <acronym title=\"Command Line Interface\">CLI<\/acronym> text editor such as <a href=\"http:\/\/vim.org\" target=\"_blank\" rel=\"noopener nofollow\" class=\"broken_link\">Vim<\/a> or <a href=\"http:\/\/www.gnu.org\/software\/emacs\/\" target=\"_blank\" rel=\"noopener\">Emacs<\/a><\/li>\n<\/ul>\n<\/li>\n<li>If using the preferred method above: a\u00a0text editor, such as <a href=\"http:\/\/notepad-plus-plus.org\" target=\"_blank\" rel=\"noopener\">Notepad++<\/a> or <a href=\"http:\/\/www.sublimetext.com\/\" target=\"_blank\" rel=\"noopener\">Sublime Text<\/a>. Choice is up to you.<\/li>\n<li>Your site&#8217;s FTP\/SSH details. If you don&#8217;t know, ask your site\/network administrator or manager. The details you will need are:\n<ul>\n<li>The FTP host name. Usually this is just your site&#8217;s address or something like\u00a0<tt>ftp.yoursitename.com<\/tt>.<\/li>\n<li>Port. By default this is <tt>21<\/tt>, although secure\u00a0connections require port <tt>22<\/tt>.<\/li>\n<li>Type of connection: SFTP or FTP.<\/li>\n<li>FTP Username<\/li>\n<li>FTP Password<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h1>Step 1: Getting connected<\/h1>\n<p>If you already know how to connect to your site via FTP or SSH, you can skip to Step 2.<\/p>\n<h2><strong>Via FTP<\/strong><\/h2>\n<p>Open FileZilla, go to File \u2192 Site Manager (<kbd>Ctrl\/Cmd + S<\/kbd>). Click the &#8220;New Site&#8221; button and enter your site&#8217;s details. Then, hit the &#8220;Connect&#8221; button.<\/p>\n<p>If you do not know your site&#8217;s FTP connection details, you will need to contact your site administrator.<\/p>\n<h2>Via SSH<\/h2>\n<p>In an SSH-supported terminal (Terminal for Mac OS\/Linux, <a href=\"http:\/\/cygwin.com\" target=\"_blank\" rel=\"noopener\">Cygwin<\/a>\/<a href=\"http:\/\/putty.org\" target=\"_blank\" rel=\"noopener\">PuTTY<\/a> for Windows), type:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nssh myusername@mysite\r\n<\/pre>\n<p>Replace <code>myusername<\/code> and <code>mysite<\/code> with the appropriate details. Then follow the instructions.<\/p>\n<h1>Step 2: Get to\u00a0the plugin<\/h1>\n<figure id=\"attachment_4953\" aria-describedby=\"caption-attachment-4953\" style=\"width: 300px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/g-liu.com\/blog\/wp-content\/uploads\/2014\/09\/away-module-itsec.jpg\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"4953\" data-permalink=\"https:\/\/g-liu.com\/blog\/2014\/09\/ithemes-security-auto-away-lock-out-fix\/away-module-itsec\/\" data-orig-file=\"https:\/\/g-liu.com\/blog\/wp-content\/uploads\/2014\/09\/away-module-itsec.jpg\" data-orig-size=\"777,352\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Geoffrey Liu&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1410175806&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"away-module-itsec\" data-image-description=\"&lt;p&gt;Away mode itsec&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;The contents of the &lt;tt&gt;away-mode&lt;\/tt&gt; directory in FileZilla&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/g-liu.com\/blog\/wp-content\/uploads\/2014\/09\/away-module-itsec-300x135.jpg\" data-large-file=\"https:\/\/g-liu.com\/blog\/wp-content\/uploads\/2014\/09\/away-module-itsec.jpg\" class=\"wp-image-4953 size-medium\" src=\"http:\/\/g-liu.com\/blog\/wp-content\/uploads\/2014\/09\/away-module-itsec-300x135.jpg\" alt=\"Away mode itsec\" width=\"300\" height=\"135\" srcset=\"https:\/\/g-liu.com\/blog\/wp-content\/uploads\/2014\/09\/away-module-itsec-300x135.jpg 300w, https:\/\/g-liu.com\/blog\/wp-content\/uploads\/2014\/09\/away-module-itsec-660x298.jpg 660w, https:\/\/g-liu.com\/blog\/wp-content\/uploads\/2014\/09\/away-module-itsec.jpg 777w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-4953\" class=\"wp-caption-text\">The contents of the <tt>away-mode<\/tt> directory in FileZilla<\/figcaption><\/figure>\n<p>In the FTP\u00a0or\u00a0SSH client, navigate to your WordPress root. Then, go to the following path:<\/p>\n<p><tt>wp-content\/plugins\/better-wp-security\/core\/modules\/away-mode<\/tt><\/p>\n<p><b>Important note:<\/b> Depending on when you installed the plugin, the <tt>better-wp-security<\/tt> folder may be named something like &#8220;<code>ithemes-security<\/code>&#8220;.<\/p>\n<p><strong>Comment:\u00a0<\/strong>By editing just the Auto Away module, you are ensuring that the other security features of the plugin are not affected. You can also manually disable the plugin by creating a folder called <tt>disabled<\/tt> in your <tt>wp-content\/plugins<\/tt> directory and moving the <tt>better-wp-security<\/tt>\/<tt>ithemes-security<\/tt> folder within. However, this will not change the Auto Away settings once you put the plugin back in its place.<\/p>\n<p>Now you should see a file called\u00a0<code>class-itsec-away-mode.php<\/code>. Open this with your text editor. In FileZilla, right click the file, then select &#8220;View\/Edit&#8221;.<\/p>\n<h1>Step 3: Edit the plugin file<\/h1>\n<p>The critical part. Perform a search for the line &#8220;<code>public static function is_active<\/code>&#8221; (<kbd>Ctrl\/Cmd + F<\/kbd> in most editors). On the latest version of iThemes, this is on line 27. Now add a new line immediately below:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nreturn false;\r\n<\/pre>\n<p>What this does is cause the <code>away-mode<\/code> module to automatically indicate to the plugin, &#8220;there is no lock-out in effect&#8221;.<\/p>\n<p>Your code around the <code>is_active<\/code> function should now look like this. You added Line 2.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\npublic static function is_active( $get_details = false ) {\r\n\treturn false;\r\n\trequire_once( dirname( __FILE__ ) . '\/utilities.php' );\r\n<\/pre>\n<p>Save the file to the server. FileZilla users: save the file in your text editor and click &#8220;Yes&#8221; when prompted in FileZilla.<\/p>\n<p><strong>At this point, make sure not to close any FileZilla or text editor windows.<\/strong><\/p>\n<h1>Step 4: Your wp-admin, unlocked<\/h1>\n<p>Go to your site&#8217;s WordPress Admin. Hooray, it is now unlocked!<\/p>\n<p>Change or remove your site&#8217;s Auto Away settings. After you have done that, undo all the changes in your text editor and save the file to the server. That is, remove the <code>return false;<\/code> line of code that you just added. This is\u00a0<em>very important<\/em> lest you want your Auto Away to never work again!<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content --><!-- AddThis Related Posts generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>A couple months ago, I got the iThemes Security WordPress plugin and set the auto-away mode from 12:00am to 6:00am. After all, I&#8217;m asleep at those times and it would make no sense to keep my admin login and backend open at these times. Or so I thought. There were nights where I would stay up late, and just recently &#8230;<!-- AddThis Advanced Settings generic via filter on wp_trim_excerpt --><!-- AddThis Share Buttons generic via filter on wp_trim_excerpt --><!-- AddThis Related Posts generic via filter on wp_trim_excerpt --><\/p>\n","protected":false},"author":2,"featured_media":5267,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"footnotes":"","jetpack_publicize_message":"Locked out by #iThemes Security\/Better WP Security Auto Away? No problem! #itsec #wordpress http:\/\/wp.me\/p2Zt3y-1h9","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[58],"tags":[],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/g-liu.com\/blog\/wp-content\/uploads\/2014\/09\/padlock.jpg","jetpack_shortlink":"https:\/\/wp.me\/p2Zt3y-1h9","_links":{"self":[{"href":"https:\/\/g-liu.com\/blog\/wp-json\/wp\/v2\/posts\/4907"}],"collection":[{"href":"https:\/\/g-liu.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/g-liu.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/g-liu.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/g-liu.com\/blog\/wp-json\/wp\/v2\/comments?post=4907"}],"version-history":[{"count":12,"href":"https:\/\/g-liu.com\/blog\/wp-json\/wp\/v2\/posts\/4907\/revisions"}],"predecessor-version":[{"id":5875,"href":"https:\/\/g-liu.com\/blog\/wp-json\/wp\/v2\/posts\/4907\/revisions\/5875"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/g-liu.com\/blog\/wp-json\/wp\/v2\/media\/5267"}],"wp:attachment":[{"href":"https:\/\/g-liu.com\/blog\/wp-json\/wp\/v2\/media?parent=4907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/g-liu.com\/blog\/wp-json\/wp\/v2\/categories?post=4907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/g-liu.com\/blog\/wp-json\/wp\/v2\/tags?post=4907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}