Friday, February 21, 2014

Google Chrome can not be run as root in Linux(Centos/Ubuntu)

 Overview

First and foremost, you should never run a web browser as root, in fact you should not run any software as root when you don’t have to. If you still wish to run chrome as a root nobody can stop you


How to run Google Chrome as root.

Right click on the launch icon and select properties.  Append the following to the command in the launcher --user-data-dir
This is what it will look like

/opt/google/chrome/google-chrome %U

just change it to be

/opt/google/chrome/google-chrome --user-data-dir %U

If you can’t find the launcher then you have to add it to panel or to your desktop. Select Applications-->Internet-->Google Chrome, right click on it and select Add this launcher to panel or Add this launcher to Desktop. Once you find the launcher icons, follow the steps above to run Chrome as a root user.



      
Command : /usr/bin/google-chrome-stable %U

[root@localhost ]# /usr/bin/google-chrome-stable --user-data-dir %U

Wednesday, February 19, 2014

How to detect IP address conflicts in Linux

IP addresses are a scarce resource that is shared by different users and devices. Having an IP address conflict means that there are more than one network device or computer that claims the same IP address. IP address conflict may occur when a DHCP server has assigned an IP address to one computer, and the same IP address happens to be statically assigned to another network device by someone.

IP address conflict can also happen when there are more than one DHCP server (typically built in a router) hooked up to the local network, autonomously giving out IP addresses from the same subnet. If you are having flaky network connectivity, and suspect it is due to IP address conflicts, you can use a tool called arp-scan to detect IP address conflicts in Linux.
arp-scan sends out ARP packets on local network to collect (IP address, Ethernet MAC address). If there is more than one Ethernet MAC address claiming the same IP address, it means there is an IP conflict.
To install arp-scan on Ubuntu or Debian:
$ sudo apt-get install arp-scan
To install arp-scan on CentOS, Fedora or Redhat:
$ sudo yum install arp-scan
To detect IP address conflicts with arp-scan, run the following.
$ sudo arp-scan -I eth0 -l
192.168.1.10   00:1b:a9:63:a2:4c       BROTHER INDUSTRIES, LTD.
192.168.1.30   00:1e:8f:58:ec:49       CANON INC.
192.168.1.33   00:25:4b:1b:10:20       Apple, Inc
192.168.1.37   10:9a:dd:55:d7:95       Apple Inc
192.168.1.38   20:c9:d0:27:8d:56       (Unknown)
192.168.1.39   d4:85:64:4d:35:be       Hewlett Packard
192.168.1.39   00:0b:46:e4:8e:6d       Cisco (DUP: 2)
192.168.1.40   90:2b:34:18:59:c0       (Unknown)
According to the example output shown above, IP address 192.168.1.39 is in conflict, where two different MAC addresses are claiming the same IP address.

Friday, February 14, 2014

Diffrence between .bash_profile vs .bashrc


W
HEN working with Linux, Unix, and Mac OS X, I always forget which bash config file to edit when I want to set my PATH and other environmental variables for my shell. Should you edit .bash_profile or .bashrc in your home directory?
You can put configurations in either file, and you can create either if it doesn’t exist. But why two different files? What is the difference?
According to the bash man page.bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells.

What is a login or non-login shell?

When you login (type username and password) via console, either sitting at the machine, or remotely via ssh:.bash_profile is executed to configure your shell before the initial command prompt.
But, if you’ve already logged into your machine and open a new terminal window (xterm) inside Gnome or KDE, then .bashrc is executed before the window command prompt. .bashrc is also run when you start a new bash instance by typing /bin/bash in a terminal.

Why two different files?

Say, you’d like to print some lengthy diagnostic information about your machine each time you login (load average, memory usage, current users, etc). You only want to see it on login, so you only want to place this in your.bash_profile. If you put it in your .bashrc, you’d see it every time you open a new terminal window.
Simple--.bash_profile->SSH 
      .bashrc------->after login GNOME/KDE