Wednesday, September 24, 2014

[Quick Tips] :How to Mount Google Drive in LINUX

How to Mount Google Drive in LINUX


More than a year after Google has announced its file storage and synchronization service called Drive, there's still no official Linux client. There are some unofficial clients, but they're not perfect: Insync is not free, Grive is command line only and its development seems to have stopped and so on.

So here's another alternative for easily managing your Google Drive files under Linux: google-drive-ocamlfuse.

google-drive-ocamlfuse is a FUSE filesystem backend for Google Drive which you can use to mount your Google Drive under Linux.


Among its features are full read/write support for regular files and folders, multiple account support, duplicate file handling as well as access to the Google Drive trash directory. google-drive-ocamlfuse also provides read-only access to Google Docs, Sheets and Slides, which its converts to ODT, ODS of PDF (this can be configured).

google-drive-ocamlfuse is still under testing so while it works pretty well, you may encounter bugs. For instance, in my test, some Google documents weren't converted for some reason.

It's also worth mentioning that the changes don't show up instantly - when you edit or upload a new file, it can take 60 seconds (this is configurable) until the changes show up in the mounted filesystem. If newly added files don't show up in your file manager, enter the folder again or refresh it (Ctrl + F).


Install google-drive-ocamlfuse in Ubuntu


Update: Google-drive-ocamlfuse is now available in a PPA. Add the PPA and install it in Ubuntu using the following commands:
sudo add-apt-repository ppa:alessandro-strada/ppa
sudo apt-get update
sudo apt-get install google-drive-ocamlfuse

Usage

Firstly, you need to authorize google-drive-ocamlfuse with Google. To do this, run the following command:
google-drive-ocamlfuse
This should open a tab in your default web browser, asking to allow google-drive-ocamlfuse to access your Google Drive. Click "Allow", wait a few seconds for google-drive-ocamlfuse to retrieve the authorization code and you're done.

Now let's mount Google Drive. Create a folder in your home directory, let's call it "gdrive":
mkdir ~/gdrive

And mount Goole Drive using the command below:
google-drive-ocamlfuse ~/gdrive

That's it. If you want to configure the interval between queries to detect server-side changes, the export format used for Google documents and so on, see the configuration file: ~/.gdfuse/default/config


To mount Google Drive on startup, add "google-drive-ocamlfuse /path/to/gdrive" (replacing "/path/to/ with the exact path to the folder where you want to mount Google Drive) to Startup Applications.

For more info, including using multiple accounts, see the google-drive-ocamlfuse wiki.

[UBUNTU] : LightDM: How To Disable The User List Or Guest Session

LightDM: How To Disable The User List Or Guest Session
Quick tips for Ubuntu / LightDM users: if you want to hide the LightDM login screen user list and / or the Guest Session for security concerns, because there are too many users or whatever other reason, here's how to do it.

Ubuntu LightDM Unity Greeter
Default LightDM login screen (Unity Greeter) with user list and Guest Session enabled

1. To disable the LightDM login screen user list and / or Guest Session, firstly create the /etc/lightdm/lightdm.conf.d/ folder in case it doesn't exist, by using the following command:
sudo mkdir -p /etc/lightdm/lightdm.conf.d

2. Next, you need to create a file called 50-my-custom-config.conf under /etc/lightdm/lightdm.conf.d/ To open/create this file using Gedit (as root), use the following command:
gksu gedit /etc/lightdm/lightdm.conf.d/50-my-custom-config.conf

3.a. To hide the LightDM login screen user list (which means you'll have to manually enter your username), paste the following in this file (50-my-custom-config.conf):
[SeatDefaults]
greeter-hide-users=true
greeter-show-manual-login=true
Then save the file.

Here's how LightDM (with Unity Greeter) will look after this change:

Ubuntu LightDM disabled user list
=========================================
For UBUNTU 14.04 and above

The file to edit is now located in /usr/share/lightdm/lightdm.conf.d, and is called: 50-ubuntu.conf.

I just added the line:
 
greeter-show-manual-login=true

and on next reboot I was able to input any user name on the login screen.

OR

The solution is to create a file lightdm.conf inside /etc/lightdm/ and put the following contents in it:
 
[SeatDefaults]
greeter-show-manual-login=true

After a system reboot, I was able to login with other users.

==============================================



3.b. To disable the LightDM Guest Session, paste the following lines in the /etc/lightdm/lightdm.conf.d/50-my-custom-config.conf file:
[SeatDefaults]
allow-guest=false
Then save the file.

Here's a screenshot with the Guest Session disabled in LightDM (with Unity Greeter):

Ubuntu LightDM disabled guest session

3.c. Of course, you can combine the two. So if you want to hide the LightDM login screen user list and also disable the Guest Session, paste this in the /etc/lightdm/lightdm.conf.d/50-my-custom-config.conf file:
[SeatDefaults]
greeter-hide-users=true
greeter-show-manual-login=true
allow-guest=false
Then save the file.

Here's a screenshot with LightDM (Unity Greeter) in which the user list was hidden and the Guest Session was disabled:

Ubuntu LightDM disabled user list guest session

4. And finally, you need to restart LightDM (a logout is not enough). To do this, press ALT + F2 and copy/paste the following command:
gksu service lightdm restart
Then press ENTER.

You can also simply restart your system.

Why not use "sudo service lightdm restart" in a terminal? Well, for some reason LightDM can't be restarted from a terminal with 'sudo'. However, you can also restart LightDM by switching to a tty (to switch to tty1 press CTRL + ALT + F1; to switch back, use CTRL + ALT + F7) and then using the "sudo service lightdm restart" command.

How to revert the changes

To revert the changes made by following the instructions above, all you need to do is remove the /etc/lightdm/lightdm.conf.d/50-my-custom-config.conf file, by using the following command:
sudo rm /etc/lightdm/lightdm.conf.d/50-my-custom-config.conf

Then, restart LightDM as explained under step 4 or reboot your computer.

Friday, September 12, 2014

[CentOS] : Nagios Auto Install Script For Fedora 19/20, And CentOS 6/7

Nagios Auto Install Script For Fedora 19/20, And CentOS 6/7


a good script to automate the installation of nagios in few steps. Using this script, you are able to install Nagios 4.0.8 and nagios plugins 2.0.3 with just single command.
1 – First download the Nagios  script from this link.
2 – Extract the file to your home directory.
3 – cd the directory where you extracted the script and run the following command:
chmod 777 Nagios-auto.sh
4 – Now run script under root.
 [root@mel-centos7 ~]# ./Nagios-auto.sh
 #############################################################
 #############################################################
 ##                                                         ##
 ##       Welcome to Nagios Auto Installation Script        ##
 ##               Written By Yogesh Panchal                 ##
 ##   Edited By Pirat9 from Unixmen Admin ##
 #############################################################
 #############################################################

 Hi Nagios Installation Requires

 ***** Apache *****
 ***** PHP *****
 ***** GCC compiler *****
 ***** GD development libraries *****

 First Install Above Pre-requesites Then continue with this script
 or You will face problems with nagios installation.

 You can Install Prerequisites using following commands
 To install Apache >>> yum install httpd
 To install PHP >>> yum install php
 To install GCC compiler >>> yum install gcc glibc glibc-common
 To install GD development libraries >>> yum install gd gd-devel

 If You have already installed Prerequisites ignore above warning & continue with this script...!
 If you have no time. let me do this command for you : yum  -y install  httpd php gcc glibc glibc-common gd gd-devel
 Loaded plugins: fastestmirror
 Loading mirror speeds from cached hostfile
 * base: centos.mirror.transip.nl
 * epel: epel.mirror.nucleus.be
 * extras: mirror2.bbln.org
 * updates: mirror2.bbln.org
 Package httpd-2.4.6-18.el7.centos.x86_64 already installed and latest version
 Package php-5.4.16-23.el7_0.x86_64 already installed and latest version
 Package gcc-4.8.2-16.2.el7_0.x86_64 already installed and latest version
 Package glibc-2.17-55.el7_0.1.x86_64 already installed and latest version
 Package glibc-common-2.17-55.el7_0.1.x86_64 already installed and latest version
 Package gd-2.0.35-26.el7.x86_64 already installed and latest version
 Package gd-devel-2.0.35-26.el7.x86_64 already installed and latest version
 Nothing to do
 Do You Want to continue with this script? [ y/n ]
i have tested this script under my centos 7 and its working fine.
 
Cheers!

Thursday, September 11, 2014

[Quick Tips] : How do I find out what version of Linux I'm running?

How do I find out what version of Linux I'm running?


The kernel is universally detected with 'uname':
$ uname -or
2.6.18-128.el5 GNU/Linux
There really isn't a cross-distribution way to determine what distribution and version you're on. There are attempts to make this consistent, but it ultimately varies, unfortunately. LSB tools provide this information, but ironically aren't installed by default everywhere. Example on an Ubuntu 9.04 system with the lsb-release package installed:
$ lsb_release -irc
Distributor ID: Ubuntu
Release:        9.04
Codename:       jaunty
Otherwise, the closest widely-available method is checking "/etc/something-release" files. These are common on most of the common platforms, or on their derivatives (ie Red Hat and CentOS).
Here's some examples.
For example, Ubuntu has /etc/lsb-release:
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.04
DISTRIB_CODENAME=jaunty
DISTRIB_DESCRIPTION="Ubuntu 9.04"
But Debian has /etc/debian_version:
cat /etc/debian_version
5.0.2
Fedora, Red Hat and CentOS have:
Fedora: cat /etc/fedora-release
Fedora release 10 (Cambridge)
Red Hat/CentOS: cat /etc/redhat-release
CentOS release 5.3 (Final)
Gentoo:
cat /etc/gentoo-release
Gentoo Base System release 1.12.11.1
I don't have a SUSE system available at the moment, but I believe it is /etc/SuSE-release.
Slackware has /etc/slackware-release.
Mandriva has /etc/mandriva-release.
For most of the popular distributions then,
cat /etc/*{release,version}
Will most often work. Stripped down and barebones "server" installations might not have the 'release' package for the distribution installed.
Additionally, two 3rd party programs you can use to automatically get this information are Ohai and Facter.
Note that many distributions have this kind of information in /etc/issue or /etc/motd, but some security policies and best practices indicate that these files should contain access notification banners.

Wednesday, September 10, 2014

Linux News : 6 best Linux distributions for children

6 best Linux distributions for children


6 best Linux distributions for children
6 best Linux distributions for children


In this article, we'll show the best six Linux distributions for children, from the age of two and above, the goal of choosing Linux here is to make the brain more susceptible to innovation, openness and freedom and the ability to exploration in the future, as is the case in the philosophy of open source. 


(1) Qimo :


6 best Linux distributions for children


Kimo, is a Linux distribution based on Ubuntu with desktop environment designed specifically for children, and comes with educational toys suitable for 3 years and above, comes with an intuitive interface and very easy with large icons so that he can see it from a young age.  


- Click here to download. 


(2) Sugar :
6 best Linux distributions for children

Sugar, distro based on Fedora are designed for portable devices and Alnotbok designed for the project, Professor Nicolas Negroponte's (Laptop Per Child "(OLPC)") dedicated to children, and is a radical departure from the desktop traditional and makes it more fun and easier to teaching and programming capabilities in computing, suitable even 6 years. 

- Click here to download. 


(3) Edubuntu  :


Is a derivative of Ubuntu officially supported, aimed at primary and secondary schools, and has three different attributes: "young", "plain", "default" and contains some beautiful software. 


- Click here to download.

(4) LinuxKidX :

6 best Linux distributions for children

This distribution based on Slackware and KDE interface used as the roof of a virtual office, includes many of the scientific and academic programming and many programs geared for children, suitable for two years and above. 

- Click here to download.


(5) Foresight for Kids :

6 best Linux distributions for children

The distribution Foresight for Kids derived from Foresight Linux distro which contain interface GNOME virtual front, and include educational programs, sports and games, a suitable age three onwards. 

- Click here to download.


(6) Doudou Linux :


6 best Linux distributions for children


Dudu Linux, based on Debian and is therefore very stable, has recast the entire desktop to make it as easy as possible for children, including a number of games and sports programs with interactive interface and division of neat to list interface. 

- Click here to download.

Tuesday, September 9, 2014

[Quick Tip] How To List All Installed Packages On Linux Distributions

To list all installed package on a Linux system depends on which distribution you are running and the package management mode used.
In this tutorial, we are going to look at commands on some of the notable and popularity used distros.
NOTE: You can pipe the less command OR redirected to a text file using the redirection operator (>). Below are examples
example | less
example > installed_packages.txt
Red Hat/Fedora Core/CentOS Linux:
rpm -qa
FreeBSD / OpenBSD:
pkg_info
Arch Linux:
pacman -Qq
Ubuntu / Debian / Linux Mint:
dpkg --get-selections
dpkg --list
dpkg -l
Good day.

[Quick Tips] : Linux Basic Commands List


Basic Linux Commands

# tty Shows the current logged in terminal
# whoami shows the currently logged in user
# which "command name" reveals where in the search path a program is located
# echo prints to the screen
# echo $PATH  dumps the current path to STDOUT
# echo $PWD     dumps ths contents of the $PWD variable
# echo $OLDPWD  dumps the most recently visited directory
# clear         clears the screen or terminal
# reset         resets the screen buffer
# history       reveals your command history
# !110  executes the 110th command in our history 

Files and Directories

# ls             list the files and directories in the present working directories
# ls -ltr        sort the files in the last modification time in reverse order
# ls -a          list all the files including hidden files and directories ( all files starting with "." are hidden files)
# ls -l          long list of all files and directories where you can check the relative permission on each file.

# mkdir "directory name"                 Create directory
# mkdir -p /"dir1"/"dir2"/"dir3"/        Create directory including parent dir
# touch "filename"                       Create files

# cp "dir1"  /root/    copy directory or file to another location
# mv dir1  /root/      move or rename the dir or file to different location

# rm "dir name"        To remove directory
# rm -rf "dir name"    To remove a directory recursively and forcefully

For further switches to be used with any of the above commands you can check using
# man "command name"
# "command name" --help

For example:
# rm --help
# mkdir --help
# ls --help


# cd            with no options changes to the $HOME directory
# cd ~          changes to the $HOME directory
# cd /          changes to the root of the file system
# cd Desktop/   changes us to the relative directory 'Desktop'
# cd ..         changes us one-level up in the directory tree
# cd ../..      changes us two-levels up in the directory tree

User and Group related

# useradd "username"                      creates a user
# passwd "username"                       Assign password to user
# groupadd "groupname"                    creates a group
# usermod -a -G "groupname" "username"    Add existing user to group
# groupmod -A username groupname          Add existing user to group

# useradd -d "directory name" -s "shell" -g "group name" -u "UID" "username"                                 Creates user with provided details

Command chain

# head /var/log/messages      displays opening lines of text files
# head -10 /var/log/messages  displays opening 10 lines of text files
# tail /var/log/messages      displays the closing lines of text files
# tail -10 /var/log/messages  displays the closing 10 lines of text files
# wc -l /var/log/messages     counts words and optionally lines of text files

[Linux Servers] : DNS : How to configure BIND-9.2 DNS server in linux



How to configure BIND-9.2 DNS server in linux
NOTE: Please take a copy of the original configuration file before making any changes to it.
Using this method you will be able to configure your machine as master DNS server for forward and reverse lookups.

Few things you need to check before starting with configuration:

For explanation I am using 192.168.0.100 (you need to give your machine's IP instead) and all other conventions will vary as per your scenario. So make sure to change them.
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
IPADDR=192.168.0.100 (will vary accordingly)
# vi /etc/resolv.conf
nameserver 192.168.0.100
# vi /etc/hosts
192.168.0.100 server.example.com server (make sure this line is present)
# vi /etc/sysconfig/network
HOSTNAME=server.example.com
you can use yum to install the binary packages. These are the packages you will be needing for the same
# yum -y install bind
# yum -y install caching-nameserver
All the files required for the configuration of nameserver are installed in the below mentioned locatoion.These are the steps you need to follow
/usr/share/doc/bind-9.3.3/sample/
you can verify the location of installed files using this command
# rpm -ql bind
So copy all the files to the new location i.e
# cp /usr/share/doc/bind-9.3.3/sample/etc/*  /var/named/chroot/etc/
# cp /usr/share/doc/bind-9.3.3/sample/var/named/*  /var/named/chroot/var/named/
# cp /usr/share/doc/bind-9.3.3/sample/var/named/slaves/*  /var/named/chroot/var/named/slaves/
# cp /etc/named.caching-nameserver  /var/named/chroot/etc/named.conf
# cd /var/named/chroot/etc/

Now edit the following files as mentioned below
# vi named.conf (check the entries in the red lines)
options {
     listen-on port 53 { 127.0.0.1; };
     listen-on-v6 port 53 { ::1; };
     directory "/var/named";
     dump-file "/var/named/data/cache_dump.db";
     statistics-file "/var/named/data/named_stats.txt";
     memstatistics-file "/var/named/data/named_mem_stats.txt";
     query-source port 53;
     query-source-v6 port 53;
     allow-query { localhost; 192.168.0.0/24;};
};

logging {
     channel default_debug {
     file "data/named.run";
     severity dynamic;
}; 
}; 
view localhost_resolver {
     match-clients { localhost; 192.168.0.0/24; };
     match-destinations { localhost; 192.168.0.0/24; };
     recursion yes;
     include "/etc/named.rfc1912.zones";
} ;
# vi named.rfc1912.zones
(add these two zones)
zone "example.com" IN {
type master;
file "example.com.zone";
allow-update {none;};
};  

zone "0.168.192.in-addr.arpa" IN {
type master;
file "192.168.0.zone";
allow-update{none;};
}; 
# cd /var/named/chroot/var/named/
# cp named.local 192.168.0.zone
# cp localhost.zone example.com.zone
# vi example.com.zone
$TTL 86400 @ IN SOA server.example.com. root.example.com. (
52 ; serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

        IN  NS   server.example.com.
        IN  MX   10 server.example.com.
server  IN  A    192.168.0.100
www     IN  CNAME    server.example.com. 
# vi 192.168.0.zone
$TTL 86400
@ IN SOA server.example.com. root.server.example.com. (
1997022703 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum 

    IN NS server.example.com.
100 IN PTR server.example.com.
Restart the named server once you are done with all the configuration.
# service named restart
If you get any error message and your service ends up with a failed status then check the log messages for troubleshooting. I will guide with few of the problems I came up with and the way I overcome those errors at the end of the configuration

check your DNS
# ping google.com
PING google.com (74.125.236.195) 56(84) bytes of data. 
64 bytes from maa03s17-in-f3.1e100.net (74.125.236.195): icmp_seq=1 ttl=53 time=48.6 ms 
64 bytes from maa03s17-in-f3.1e100.net (74.125.236.195): icmp_seq=2 ttl=53 time=54.1 ms 
64 bytes from maa03s17-in-f3.1e100.net (74.125.236.195): icmp_seq=3 ttl=53 time=50.7 ms 
64 bytes from maa03s17-in-f3.1e100.net (74.125.236.195): icmp_seq=4 ttl=53 time=50.5 ms 
# dig -x 192.168.0.100
; <<>> DiG 9.3.3rc2 <<>> -x 192.168.0.100 
;; global options: printcmd 
;; Got answer: 
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45439 
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1,  ADDITIONAL: 1 
;; QUESTION SECTION: 
;100.0.168.192.in-addr.arpa. IN PTR 
;; ANSWER SECTION: 
100.0.168.192.in-addr.arpa. 86400 IN PTR server.example.com. 
;; AUTHORITY SECTION: 
0.168.192.in-addr.arpa. 86400 IN NS server.example.com. 
;; ADDITIONAL SECTION: 
server.example.com. 86400 IN A 192.168.0.100 
;; Query time: 1 msec 
;; SERVER: 192.168.0.100#53(192.168.0.100) 
;; WHEN: Thu Nov 10 07:55:59 2011 
;; MSG SIZE rcvd: 107 
# nslookup server.example.com 
Server: 192.168.0.100 
Address: 192.168.0.100#53 

Name: server.example.com 
Address: 192.168.0.100 


DNS server related errors
These are some of the issues which I had faced while working on the DNS server along with their solution. Kindly update me in the comment box with any other errors or problem you face while working with DNS servers.

Error 1:
# service named restart
Starting named:
Error in named configuration: /etc/named.rfc1912.zones:10: zone '.': already exists previous definition: /etc/named.root.hints:12

Solution:
There is a double entry of zone'.' section in named.rfc.1912.zones and named.root.hints

So remove the zone'.' section from any one of the both i.e. named.rfc.1912.zones ornamed.root.hints

Error 2:
Unable to ping the network or internet after configuring DNS server

Solution:

This means that you have not configured your DNS server properly and the error is no where related to zone files. So check your named.conf and named.rfc.1912.zones file.

Check the permissions on these files as we donot check the permission on these files once we copy it from the default location.

The permission on these files should look like this
# ls -l /var/named/chroot/etc/named*
-rw-r--r--. 1 root named 7731 May 16 10:11 named.conf
-rw-r--r--. 1 root named 2544 Jan 10 14:36 named.iscdlv.key
-rw-r--r--. 1 root named 1159 May 16 10:09 named.rfc1912.zones
-rw-r--r--. 1 root named 487 Jan 10 14:36 named.root.key

Error 3:
This is quite unusual problem and hopefully you won't get this issue but still in case face this problem when it happens that your DNS server is configured properly but still your are unable to connect to internet.

Solution:
This generally happens due to difference in the default time zone selected and the date or time of the local machine is different. So update the date and time of your local machine as per the time zone selected (for eg in INDIA we select Asia/Calcutta).