WordPress : Website for logged in users only

If you want to hide your wordpress website, so that, only logged in users may access it. So, here’s the quick fix.

append following code into your wp-blog-header.php file right below wp();

/////////////////////////// Require login to view website
global $user_ID;
if ($user_ID == '')
        header('Location: wp-login.php');
////////////////////////// Require login to view website

Thats it. Simple enough ?

SSH access : Time saVVy Hack

If you deal with a lot of servers and SSH connections, then this post is a must read for you, welcome.

I will go through some easy tricks, which will make your SSH login to server without asking a things.

How to setup :

  1. Setup key based SSH access
  2. Command alias

Start with issuing following commands :

$ ssh-keygen

Then ssh-keygen will ask you the filename in which to store the generated key in ~/.ssh/YourFileName

Next, copy the key’s .pub file to the server, which you want to connect using ssh.

$ ssh-copy-id -i ~/.ssh/YourFileName.pub user@server.com

now open you ~/.bashrc file, and add alias. Paste this code in the end of your .bashrc file, and change values accordingly

alias conny='ssh user@server'

Save and exit, thats it, you just run $ conny or any other name you wrote there. It will setup an SSH connection directly to the server.