Michael Dudli

Michael Dudli

Cloud Specialist with more than 10 years experience in the Hosting Business. Website URL: http://www.cloudserver24.com

How to Tell What Version of Linux You Are Running

  • Published in Basics

If you are using Linux and you don’t know what version of Linux you are using then believe me that’s the strangest thing on earth. This is one of the basic function of Linux and every user and administrator should know that what version he or she is working on. In this article I will show you by commands that how can we check the version of Linux.

1) The simplest and easiest way to check Linux version is by the following command

#cat /etc/issue

You will get an output like

Ubuntu 14.04.1 LTS


2) Another command that is used extensively and for a detailed explanation of your Linux version is as follows

#cat /etc/*release


3) To check the kernel version installed on you Linux you can use the following command 

#uname -r


4) To check what bit kernel you are using just enter the following command and it will come out as output

#uname –a

That can be of two types, one is 32 bit and the other is of 64 bit 


How to Secure SSH with Google Authenticator’s Two-Factor Authentication

SSH access is always critical and if you are a good Linux administrator then you will always find ways to secure your SSH access. In this article we will see how we can secure SSH with simple two factor of Google authentication. Before using it you have to integrate it with Google Authenticator one time password protocol TOTP. Another restriction is that you must have your android phone with you all the time or at least the time you need SSH access. 

First of all we will install open source and easy to install Google Authenticator PAM module by the following command. 

#apt-get install libpam-google-authenticator

This command will only enable PAM module and you have to enable SSH access after it.

The next step is to create an authentication key by using the following command 


You have to answer some questions by saying Y or N and after you are done with this Google will provide you with emergency scratch codes and save these somewhere as they are for the use when you have lost your cell phone 

Now enter the secret key in your newly and easily avaialable Google authenticator application on your android phone and now you have constantly changing verification code on your phone. 

You can have different keys for different users. 

Next step is to activate SSH for Google authenticator. To do it you have to open a file by following command

#vi /etc/pam.d/sshd

Add the following line to the end of the file

auth required pam_google_authenticator.so

now open sshd config file

#vi /etc/ssh/sshd_config

Add the following line if commented 

ChallengeResponseAuthentication yes

Then last but not the least restart the service by following command

#/etc/init.d/sshd restart


How to generate random passwords from commands

  • Published in Basics

Password is an important security feature for Linux and all other OS. It’s good to have the computer generate a random and complex password that is hard to break. In this post I will show you how a good password can be generated.

1) This method uses SHA to hash the date 

date +%s | sha256sum | base64 | head -c 32 ; echo

2) This command uses Linux built in feature which is present in /dev/random

< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;

3) This is a unique method and you must have openssl installed before you use this method 

openssl rand -base64 32

4) This is a powerful example of bash and it works in reverse of the urandom function

tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1

5) This is a very different method that uses string command to generate a password

strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n'; echo

6) A more simpler version of urandom can be done by the following command

< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6

7) “dd” command is also used to produce random password

dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev

8) Linux provides you the facility to create random password that can be typed with left hand only

</dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c8; echo ""

9) Randpw function can make every thing easier for you just by using it in any line

randpw(){ < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;}

10) Last but not the least the most easiest way to generate a password is by date command with combination of mdh5

date | md5sum


How to Change How Long sudo Waits Before it Prompts You Again

  • Published in Basics

If you are Linux administrator sudo command comes in your every minute job and you may have noticed that if you run another command using sudo shortly after the first command, you are not prompted for your password again.

You can customize the length of that grace period in which you are not asked to enter your password for the sudo command again by changing a setting for the sudo command.

We will open the “/etc/sudoers” file and change a setting to customize the length of the grace period. To begin, press Ctrl + Alt + T to open a Terminal window. Type the following command at the prompt and press Enter.

#sudo visudo

Type the password and press Enter

Search for the following line: 

Defaults         env_reset

Change the line by adding “, timestamp_timeout=x” to the end of the line.

This line will become like this 

Defaults                 env_reset, timestamp_timeout=x

Here “x” shows the amount of time of grace period or the time you want to wait

x is in minutes


Subscribe to this RSS feed