Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Thursday, November 12, 2015

How to secure your SSH login with Google Two Step Authentication on Debian/Ubuntu based servers.

Most of us are in habit of SSHing to our linux machine on regular basis.So we obviously want to secure it from someone misusing it . Google provides Google Authenticator’s time-based one-time password (TOTP) system which is open source to secure your SSH session.
Warning:Unlike Google 2-Step Account Authentication Google will not phone or SMS your Authentication Code to you if you have deleted the app from your phone or have set it up without setting up Google Authenticator on your phone.All work happen on your ssh server and your phone.

Installing Google Authenticator on Server:

To implement multi stage Google Authentication we will need Google Authenticator PAM module . PAM stands for "pluggable authentication module"which helps plug different form of authentication on linux system.

Google Authenticator PAM can be installed in two ways
Method 1: Installing using official Ubuntu/Debian Repository (preferred for newbie)
  • Type the below command in terminal
  • sudo apt-get install libpam-google-authenticator
    
Method 2: Installing latest commit using Git
  • Clone the official Google Authenticator OpenSource repository
  • git clone https://github.com/google/google-authenticator.git
    
  • Change Directory to google-authenticator/libpam/
  • cd google-authenticator/libpam/
    
  • To build Google Authenticator we first need to install prerequisite software 
  • sudo apt-get install dh-autoreconf build-essential libpam0g-dev
    
  • Then run following command to build libpam-google-authenticator.
  • ./bootstrap.sh
    ./configure
    make
    sudo make install
    
Note:While running running "make install" you must be root.
  • For making it  functional on debian/ubuntu we need create softlink in /lib/ directory.
  • ln -s /usr/local/lib/security/ /lib/
Note:This will only install Google Authenticator PAM module on your system.You will have to configure PAM manually to work with SSH

Run Google Authenticator:

  • Login as user you want to use two-step authentication with.Open Terminal and type google-autheticator command to create a secret key for that user and follow the instruction given below
  • Google Authenticator  will generate and display secret key and several emergency code , write down emergency code in case you lose your phone . Also emergency code is stored in  home directory of user under  ~/.google_authenticator

Setting up Google Authenticator on phone:

  • Enter the secret key or scan QR code in Google Authenticator app on your phone (official application is available for Android, IOS and Blackberry)
  • Windows Phone user can use Authenticator App from Windows Store , and scan QR code generated in application or enter secret key manually.
Note:If you want to remotely login as multiple user you need to run setup for each user separately

Setting up Google Authenticator on Linux:

Warning:Before continuing further  be sure that you have setup Google Authenicator app on your phone with the secret key generated for your user.
  • You need to enable google authenticator for ssh by editing /etc/pam.d/sshd file on your system by running following command
  • sudo nano /etc/pam.d/sshd
    
  • Then add following line at end of file 
  • auth required pam_google_authenticator.so nullok
    
  • Save the file by pressing Ctrl+O and Ctrl+X
  • Next,open /etc/sshd/sshd_config file by running following command
  • sudo nano /etc/ssh/sshd_config
    
  • Then find the ChallengeResponseAuthentication and edit it as follow and save it
  • ChallengeResponseAuthentication yes
    
Note::If ChallengeResponseAuthentication doesn't  exist in your sshd_config file then add above line to sshd_config file
Alternate:Instead of follwing above steps you can just copy paste following steps in the terminal
sudo -s
echo -e "#Google Authenticator for SSH\nauth required pam_google_authenticator.so nullok" >> /etc/pam.d/sshd
sed -i.bak -E -e 's/(ChallengeResponseAuthentication) no/  yes/' /etc/ssh/sshd_config

  • Finally restart SSH shell
  • sudo service ssh restart
    
  • Then try to ssh into your system using different system , you will be presented with below screen 


Monday, June 1, 2015

OpenFOAM 2.4.x Installation and Update Script for Ubuntu

Greetings foamers;
I have made a script which make installation of OpenFOAM 2.4.x on any Ubuntu distribution;
installation process is fairly easy.
Tested on Kubuntu 14.04 x64 .
The script also has update function which will help you get latest git commit and automate your build for the latest commit
Current support for Ubuntu 12.04 , 14.04 , 14.10 and 15.04
Installation steps are shown in video

If there is any error faced during installation please post here
PS:This is my first screen cast so please bear with me ; also my microphone is giving hissing noise so no audio for now . 


Saturday, January 3, 2015

(Update)OpenFOAM 2.3.x ,Paraview 4.2.0 and pyFoam quick installation for Ubuntu 14.04 X86_ 64

This is updated version of OpenFOAM installation script link
Changelog:

  • End-User has choice to install only OpenFOAM or with pyFoam
  • Updated to git build version 2.3.x-88effc40ded8

For new user follow this step:

  • Open directory where you have downloaded  OpenFOAM-2.3.x-88effc40ded8.tar.gz
  • Extract file in current work directory 
  • Change to OpenFOAM-2.3.x-88effc40ded8 directory
  • Open Terminal in OpenFOAM-2.3.x-88effc40ded8
  • Type in your terminal
            ./OpenFOAM_install.sh
  • If you want to install in root file system ; you need to run in terminal before running the script (Proceed with caution.I am not responsible for any harm that comes to your system )
          sudo -s
  • Close your terminal and open new terminal and type your alias like of23x
For old user :
  • You need to delete previous installation from where you installed 
  • remove alias of of230 or custom alias from ./bashrc by typing in terminal
          nano ~/.bashrc  
or use your any of favorite editor .

  •   And follow steps for new users and you are good to go 
Report any error in comment section.

Monday, February 20, 2012

Youtube Video Downloader and Convertor for Linux


Have wanted to have Youtube video that you watched to be stored on your pc , so you can view it when you are offline, or ever liked a rare song that you would like to have on your mp3 player. Then Downverter is excellent tools for you folks out there using Linux.
Downverter give variety of option for conversion option . It supports downloading video directly in HD an HQ format .
It also automatically coverts You tube video so you can use it with your  iPod, PSP, Pocket PC or Mobile Phone .
Install can be done in  3 easy steps : 
  • Download from the site http://www.downverter.com/ the  .deb file (As shown in image above)
  • Change directory to where you have saved the file 
  • Use the code
dpkg -i downverter-32.deb  
dpkg -i downverter-64.deb
Caution: I Have tested for ubuntu and Linux Mint . It should work on other debian system You can use .deb to .rpm converter for fedora but I am not 100% sure it will work . You can use similar methods for other linux to work.

Friday, February 10, 2012

Tutorials:How To Setup ownCloud 3 on your server


ownCloud 3 is open source cloud computing software. owncloud helps you to easily access your file from anywhere in the world . You can edit the file on the web browser or you edit it on your PC using standard software and your changes will be saved on server also . If you have good collection of music like me and don't have so much space on your smartphone or tablet , you can stream music from owncloud. You can also backup your contact on ownCloud 3 and forget the worry about lossing them ever...
Setting up owncloud 3 is very easy
Pre-needed :-
1.You need Web hosting with sql support
2.Some basic sql knowledge
Steps to owncloud:-
1.Download the ownCloud 3 software from http://owncloud.org/
2.Extract owncloud-3.0.0.tar.bz2 to your directory
3.Upload all files to your server public__html

4.Via FTP client, create a directory data , set permissions to 750 and those of config/ to 777
5.Go to your website URL and follow the pictures to install it correctly 

6.That it now you can access your file from anywhere in the world
 7.To access webdav from ubuntu 11.10 follow the pic