Monday, February 25, 2013

Linux Authentication Files

There are the following files related to users/groups/passwords:


  1. /etc/passwd    It is related to user info.
  2. /etc/shadow    It is related to user password info
  3. /etc/group       It is related to group info
  4. /etc/gshadow  It is related to group password info
  5. /etc/default/useradd  It is related to default attribute of a new user
  6. /etc/login.defs  It is related to password default info.

#vim /etc/passwd



  • Username: It is used when user logs in. It should be between 1 and 32 characters in length.
  •  Password: An x character indicates that encrypted password is stored in /etc/shadow file.
  •  UID: Each user must be assigned a user ID (UID). UID 0 (zero) is reserved for root and UIDs 1-99
  • are reserved for other predefined accounts.
  •  GID: The primary group ID (stored in /etc/group file)
  • Label: The comment field. It allow you to add extra information about the users such as user's full name,
  • phone number etc.
  • Home directory: The absolute path to the directory the user will be in when they log in. If this directory does not exists then users directory becomes /
  • Login shell: The absolute path of a command or shell (/bin/bash). Typically, this is a shell.
The permission of this file is 644 means -rw-r--r-- 
To check permission : ls -ll /etc/passwd

Linux Authentication Files

There are the following files related to users/groups/passwords:


  1. /etc/passwd    It is related to user info.
  2. /etc/shadow    It is related to user password info
  3. /etc/group       It is related to group info
  4. /etc/gshadow  It is related to group password info
  5. /etc/default/useradd  It is related to default attribute of a new user
  6. /etc/login.defs  It is related to password default info.

#vim /etc/passwd



  • Username: It is used when user logs in. It should be between 1 and 32 characters in length.
  •  Password: An x character indicates that encrypted password is stored in /etc/shadow file.
  •  UID: Each user must be assigned a user ID (UID). UID 0 (zero) is reserved for root and UIDs 1-99
  • are reserved for other predefined accounts.
  •  GID: The primary group ID (stored in /etc/group file)
  • Label: The comment field. It allow you to add extra information about the users such as user's full name,
  • phone number etc.
  • Home directory: The absolute path to the directory the user will be in when they log in. If this directory does not exists then users directory becomes /
  • Login shell: The absolute path of a command or shell (/bin/bash). Typically, this is a shell.
The permission of this file is 644 means -rw-r--r-- 
To check permission : ls -ll /etc/passwd

Sunday, February 24, 2013

Linux - Authentication

Authentication : Validating the authenticity of something or someone.
In linux system authentication means that you are a valid linux user or not. In linux when we create a user we always give a password for that user, that username and passsword is a way to check authenticity of a valid user in linux system.
There are 3 types of users in linux-
1) Super User(root)
2) System User
3) Local User

Super user or root user is automatically created when we install linux and its has administrator privileges for all services in linux system.
System user also called service user, Services like apache, ftp, printing are service accounts and these services run by there own service accounts.
Local user or regular user is a normal user, its has some necessary priviliges to perform tasks in linux like copy files, run web-browser etc.

Each user has a unique identification number. Root user has a uid 0. All system users have uid between 1-500. All normal users have uid above 500.

We all know that linux is all about files, whenever we create somnething in linux it directly affects some sort of files, so in the case of creating users also affect some configuration files: Click Here to find out what those files are and where they reside in the linux system.

Linux - Authentication

Authentication : Validating the authenticity of something or someone.
In linux system authentication means that you are a valid linux user or not. In linux when we create a user we always give a password for that user, that username and passsword is a way to check authenticity of a valid user in linux system.
There are 3 types of users in linux-
1) Super User(root)
2) System User
3) Local User

Super user or root user is automatically created when we install linux and its has administrator privileges for all services in linux system.
System user also called service user, Services like apache, ftp, printing are service accounts and these services run by there own service accounts.
Local user or regular user is a normal user, its has some necessary priviliges to perform tasks in linux like copy files, run web-browser etc.

Each user has a unique identification number. Root user has a uid 0. All system users have uid between 1-500. All normal users have uid above 500.

We all know that linux is all about files, whenever we create somnething in linux it directly affects some sort of files, so in the case of creating users also affect some configuration files: Click Here to find out what those files are and where they reside in the linux system.

Android apps on Your PC or Laptop.

We all know that android apps runs on android based phones, but there is a technique by which you can run your android apps like whatsapp, angrybirds etc on your laptop or PC. You only need a software called bluestack for your windows or mac. Install this software on your pc and sign in with your google account and      
install your favorite apps easily, you can apps in android playstore.
It looks like this:


You can Download this software from bluestack website. 
Here is the link : Bluestack

Android apps on Your PC or Laptop.

We all know that android apps runs on android based phones, but there is a technique by which you can run your android apps like whatsapp, angrybirds etc on your laptop or PC. You only need a software called bluestack for your windows or mac. Install this software on your pc and sign in with your google account and      
install your favorite apps easily, you can apps in android playstore.
It looks like this:


You can Download this software from bluestack website. 
Here is the link : Bluestack

Tuesday, February 19, 2013

How to make your Laptop as HotSpot Wifi

Hotspot feature is basically available in android phones now a days. But you can make your laptop as a Hotspot so that any other laptops and wifi enabled phones connect with your hotspot and use internet easily. This will work on windows 7 and windows 8.

  • Connect Your Laptop with internet either any Dongel or Ethrnet connection.
  •  Go to RUN (shortcut is windows + R ) and type  C:\Windows\system32 and press enter and find cmd.exe and right click on it and click on RUN AS ADMINISTRATOR. In short open command prompt run as administrator.
Now type the following command. 

netsh wlan set hostednetwork mode=allow ssid=Hotspot key=Password 
(Note: Here ssid can be any name and key can be anything because its your password)

  • Your hosted network is set now. Next you have to start your hosted network.
  • Now type the following command in same command prompt.
  
 netsh wlan start hosted network

  • Your hosted network has been started.To check your hosted network type following command:
netsh wlan show hosted network

  • Next share your internet connection in the network connections.

Note: Remeber always start command prompt as administrator. and next time just only start hosted network by second command.








How to make your Laptop as HotSpot Wifi

Hotspot feature is basically available in android phones now a days. But you can make your laptop as a Hotspot so that any other laptops and wifi enabled phones connect with your hotspot and use internet easily. This will work on windows 7 and windows 8.

  • Connect Your Laptop with internet either any Dongel or Ethrnet connection.
  •  Go to RUN (shortcut is windows + R ) and type  C:\Windows\system32 and press enter and find cmd.exe and right click on it and click on RUN AS ADMINISTRATOR. In short open command prompt run as administrator.
Now type the following command. 

netsh wlan set hostednetwork mode=allow ssid=Hotspot key=Password 
(Note: Here ssid can be any name and key can be anything because its your password)

  • Your hosted network is set now. Next you have to start your hosted network.
  • Now type the following command in same command prompt.
  
 netsh wlan start hosted network

  • Your hosted network has been started.To check your hosted network type following command:
netsh wlan show hosted network

  • Next share your internet connection in the network connections.

Note: Remeber always start command prompt as administrator. and next time just only start hosted network by second command.








Monday, February 18, 2013

Android - Samsung galaxy ace S5830 Wifi driver problem.

Problem: It's a common problem in samsung galaxy ace S5830. Whenever you turn on your wifi the light goes on and stop automatically or wifi goes off as you start, sometime it shows Error as you turn on your wifi from Setting section. One solution of this problem is restart your mobile phone. But this is not the permanent solution. So i found this solution from google and i am sharing here on my blog.

Step 1) Open phone dial-or.
Step 2) Dial  *#*#526#*#* 
Step 3) A message will appear that driver loading successfully.
Step 4) Now turn on your wifi.

Note: Sometime at step 4 it says driver loading unsuccessful then you have to restart your phone.

Android - Samsung galaxy ace S5830 Wifi driver problem.

Problem: It's a common problem in samsung galaxy ace S5830. Whenever you turn on your wifi the light goes on and stop automatically or wifi goes off as you start, sometime it shows Error as you turn on your wifi from Setting section. One solution of this problem is restart your mobile phone. But this is not the permanent solution. So i found this solution from google and i am sharing here on my blog.

Step 1) Open phone dial-or.
Step 2) Dial  *#*#526#*#* 
Step 3) A message will appear that driver loading successfully.
Step 4) Now turn on your wifi.

Note: Sometime at step 4 it says driver loading unsuccessful then you have to restart your phone.

How to add user/group in linux.

How to add user in linux via terminal.

#useradd
#passwd

Useradd command and passwd command only run by administrator.

User can change password later with passwd command.

How to add group in linux via terminal

#groupadd

How to add user/group in linux.

How to add user in linux via terminal.

#useradd
#passwd

Useradd command and passwd command only run by administrator.

User can change password later with passwd command.

How to add group in linux via terminal

#groupadd

Linux - Hard Link / Soft Link

Hard/Soft link in linux are basically shortcuts like in windows but there is slightly difference in linux and windows. Hard/Soft link are based on inode table in linux. Whenever we create any partition in linux there is always a separate table has been created in which stores various information like size,device id, user id etc.
Its like a data structure. Inode no  is a unique identify number, whenever we create a file . inode number generates automatically. Following are the information stored in inode table :-

  • Size of file
  • Device ID
  • User ID of the file
  • Group ID of the file
  • The file mode information and access privileges for owner, group and others
  • File protection flags
  • The timestamps for file creation, modification etc
  • link counter to determine the number of hard links
  • Pointers to the blocks storing file’s contents
Whenever we access an file in directory we usally give a file name but internally the file name is mapped with indoe number in inode table.
To view your indoe number of a file:
#ls -li

#df -i 
(To check inode table in File System)

Hard Link:
#ln
(This command is use for creating hard links in linux)
hard link

As you can see file 'x' and 'x2' have same i-node number in inode table.(Here number 2 is denoting as 2 links of file)
Hard link makes your file point to same file even if you delete the original file. You can not find out which is the original file and which is hard link by looking the file if you don't know already.

Note: Hard Links/ Soft Links never create a new file. 
If you copy the file than it creates a new file and takes space in the partition.
Note: Hard link only creates in same partition.

Soft Link:
#ln -s  
(-s is for soft link, soft link is similar to shortcut in windows, if you delete soft link you can not access original file.

Linux - Hard Link / Soft Link

Hard/Soft link in linux are basically shortcuts like in windows but there is slightly difference in linux and windows. Hard/Soft link are based on inode table in linux. Whenever we create any partition in linux there is always a separate table has been created in which stores various information like size,device id, user id etc.
Its like a data structure. Inode no  is a unique identify number, whenever we create a file . inode number generates automatically. Following are the information stored in inode table :-

  • Size of file
  • Device ID
  • User ID of the file
  • Group ID of the file
  • The file mode information and access privileges for owner, group and others
  • File protection flags
  • The timestamps for file creation, modification etc
  • link counter to determine the number of hard links
  • Pointers to the blocks storing file’s contents
Whenever we access an file in directory we usally give a file name but internally the file name is mapped with indoe number in inode table.
To view your indoe number of a file:
#ls -li

#df -i 
(To check inode table in File System)

Hard Link:
#ln
(This command is use for creating hard links in linux)
hard link

As you can see file 'x' and 'x2' have same i-node number in inode table.(Here number 2 is denoting as 2 links of file)
Hard link makes your file point to same file even if you delete the original file. You can not find out which is the original file and which is hard link by looking the file if you don't know already.

Note: Hard Links/ Soft Links never create a new file. 
If you copy the file than it creates a new file and takes space in the partition.
Note: Hard link only creates in same partition.

Soft Link:
#ln -s  
(-s is for soft link, soft link is similar to shortcut in windows, if you delete soft link you can not access original file.

Sunday, February 17, 2013

Linux - Backup using tar command

Tar is one of the most common utility in linux to archive files and directories. Tar- Tape Archive

Syntax:

#tar   [options]

operations: create,update,append etc
options:
-C --directory,
-f  --file,
-j  --bzip2,
-v  --verbose,
-z  --gzip

#tar -cvf home.tar /home


For extract :

#tar -xvf home.tar

#tar -cjvf  /home home_bzip2.tar
(Compression using bzip2 is more compressive form than normal)

#tar -czvf /home home_gzip.tar
( Compression using bzip2 is more compressive form than bzip2)

To check the size of tar in human readable form:
#ls -lh *.tar

For more info type "man tar"

Linux - Backup using tar command

Tar is one of the most common utility in linux to archive files and directories. Tar- Tape Archive

Syntax:

#tar   [options]

operations: create,update,append etc
options:
-C --directory,
-f  --file,
-j  --bzip2,
-v  --verbose,
-z  --gzip

#tar -cvf home.tar /home


For extract :

#tar -xvf home.tar

#tar -cjvf  /home home_bzip2.tar
(Compression using bzip2 is more compressive form than normal)

#tar -czvf /home home_gzip.tar
( Compression using bzip2 is more compressive form than bzip2)

To check the size of tar in human readable form:
#ls -lh *.tar

For more info type "man tar"

Modes in Vi Editor

There are different modes in vi editor. These modes let you to write in text or execute command.
1) Command mode: This is default mode in linux when you enter or open a file using vi editor. you can cut/copy/delete/undo/paste commands in the command section.

Cut             x
Copy          yy
Paste          p
Undo          u
delete line   dd
delete word dw

2) Insertion mode: This mode is use for writing text in the file.For insertion mode you have to press 'i' on the keyboard. As you press 'i' your insertion mode is enabled.

3) Execute mode: This mode is use to execute command like save/save without exit/exit without save. For execution mode you have to press ESC when you complete your text then press
 colon (:) and then type following commands.

Save and quit              wq!
Save without quit      w!
Quit without Saving  q!

 

Modes in Vi Editor

There are different modes in vi editor. These modes let you to write in text or execute command.
1) Command mode: This is default mode in linux when you enter or open a file using vi editor. you can cut/copy/delete/undo/paste commands in the command section.

Cut             x
Copy          yy
Paste          p
Undo          u
delete line   dd
delete word dw

2) Insertion mode: This mode is use for writing text in the file.For insertion mode you have to press 'i' on the keyboard. As you press 'i' your insertion mode is enabled.

3) Execute mode: This mode is use to execute command like save/save without exit/exit without save. For execution mode you have to press ESC when you complete your text then press
 colon (:) and then type following commands.

Save and quit              wq!
Save without quit      w!
Quit without Saving  q!

 

Editors in Redhat Linux

Editors are use to write your text and save it for future purpose. its like a notepad in Windows. There are many text editors are available in linux. Some of the following editors are:

1) Emacs :
From Wikipedia, the free encyclopedia
Emacs (pron.: /ˈiːmæks/) and its derivatives are a family of text editors that are characterized by their extensibility. The manual for one variant describes it as "the extensible, customizable, self-documenting, real-time display editor.
Emacs became, along with vi, one of the two main contenders in the traditional editor wars of Unix culture. The word "emacs" is often pluralized as emacsen by analogy with boxen and VAXen.

How to open Emac editor:
#emacs


2) vi :
From Wikipedia, the free encyclopedia
vi (pron.: /ˈviːˈaɪ/) is a screen-oriented text editor originally created for the Unix operating system. The portable subset of the behavior of vi and programs based on it, and the ex editor language supported within these programs, is described by (and thus standardized by) the Single Unix Specification and POSIX.

 How to open Emac editor
#vi



3) GEdit

From Wikipedia, the free encyclopedia
gedit is a text editor for the GNOME desktop environment, Mac OS X and Microsoft Windows. Designed as a general purpose text editor, gedit emphasizes simplicity and ease of use. It includes tools for editing source code and structured text such as markup languages.
It is designed to have a clean, simple graphical user interface according to the philosophy of the GNOME project, and it is the default text editor for GNOME.

How to open gedit:
#gedit

Editors in Redhat Linux

Editors are use to write your text and save it for future purpose. its like a notepad in Windows. There are many text editors are available in linux. Some of the following editors are:

1) Emacs :
From Wikipedia, the free encyclopedia
Emacs (pron.: /ˈiːmæks/) and its derivatives are a family of text editors that are characterized by their extensibility. The manual for one variant describes it as "the extensible, customizable, self-documenting, real-time display editor.
Emacs became, along with vi, one of the two main contenders in the traditional editor wars of Unix culture. The word "emacs" is often pluralized as emacsen by analogy with boxen and VAXen.

How to open Emac editor:
#emacs


2) vi :
From Wikipedia, the free encyclopedia
vi (pron.: /ˈviːˈaɪ/) is a screen-oriented text editor originally created for the Unix operating system. The portable subset of the behavior of vi and programs based on it, and the ex editor language supported within these programs, is described by (and thus standardized by) the Single Unix Specification and POSIX.

 How to open Emac editor
#vi



3) GEdit

From Wikipedia, the free encyclopedia
gedit is a text editor for the GNOME desktop environment, Mac OS X and Microsoft Windows. Designed as a general purpose text editor, gedit emphasizes simplicity and ease of use. It includes tools for editing source code and structured text such as markup languages.
It is designed to have a clean, simple graphical user interface according to the philosophy of the GNOME project, and it is the default text editor for GNOME.

How to open gedit:
#gedit

Switch between different terminals in VMware Workstation

You can easily switch between different terminals in linux(here i am talking about redhat). In VMware function keys from F1 to F12 are used to switch terminals.

Key:

Control + Alt + F1-F12

or

Press  Ctrl + Alt + Space then press F1 to F12(while holding ctrl+alt) any key.



Switch between different terminals in VMware Workstation

You can easily switch between different terminals in linux(here i am talking about redhat). In VMware function keys from F1 to F12 are used to switch terminals.

Key:

Control + Alt + F1-F12

or

Press  Ctrl + Alt + Space then press F1 to F12(while holding ctrl+alt) any key.



Linux Basic Commands 3

#history
( History command in linux is used to check your previous fired commands, for eg you can see last 100 commands you fired or 50th command you fired)
#history
(This will give you all commands you fired)
#history 40
(This will give you last 40 commands including the current history command also)
#history -d 4
(Delete the 4th command in the history)
#history -c
(Delete all history commands)
#history 100 | head -1
(In this command we use pipe sign which is combined 2 or more commands, here first, last 100 fired commands comes as a output then this output goes for second command which is "head -1" which actually display 1 command from the previous output.
history command

Linux Basic Commands 3

#history
( History command in linux is used to check your previous fired commands, for eg you can see last 100 commands you fired or 50th command you fired)
#history
(This will give you all commands you fired)
#history 40
(This will give you last 40 commands including the current history command also)
#history -d 4
(Delete the 4th command in the history)
#history -c
(Delete all history commands)
#history 100 | head -1
(In this command we use pipe sign which is combined 2 or more commands, here first, last 100 fired commands comes as a output then this output goes for second command which is "head -1" which actually display 1 command from the previous output.
history command

Linux Basic Commands 2

#mkdir
(use to create directory in linux)

#cp
(Copy contents or directory)
Eg:

#cp  
#cp -rfi dir1 dir2
(Here -rfi means recursive, force, intteractive prompt)
linux mkdir, copy and ls command
 


#touch
(Touch command is used to create a blank file)



#mv  
(mv command is used both for move and rename the file/directory)

#rmdir
(Removes empty directory)

Linux Basic Commands 2

#mkdir
(use to create directory in linux)

#cp
(Copy contents or directory)
Eg:

#cp  
#cp -rfi dir1 dir2
(Here -rfi means recursive, force, intteractive prompt)
linux mkdir, copy and ls command
 


#touch
(Touch command is used to create a blank file)



#mv  
(mv command is used both for move and rename the file/directory)

#rmdir
(Removes empty directory)

Linux Basic Commands

#pwd
(To check present working directory)

#cd
(Change Directory)

#cal
(Display current month calendar)

#cal 2012
(Display 2012 year calendar)

#cal 02 2012
(Display feb month of 2012)

#date
(Display current date with month and time)

#man
(its like Help command in linux)

#ls
(for listing folder and files)

#ls -l
(for long listing)

#ls -l /home
(List /home directory)

#ls -al
(Listing all file including hidden files, hidden files in linux start with .(DOT))



Linux Basic Commands

#pwd
(To check present working directory)

#cd
(Change Directory)

#cal
(Display current month calendar)

#cal 2012
(Display 2012 year calendar)

#cal 02 2012
(Display feb month of 2012)

#date
(Display current date with month and time)

#man
(its like Help command in linux)

#ls
(for listing folder and files)

#ls -l
(for long listing)

#ls -l /home
(List /home directory)

#ls -al
(Listing all file including hidden files, hidden files in linux start with .(DOT))