Slide

  • LINUX

    LINUX:In 1969 AT&T made a decision to withdraw Multics and go with GECOS (General Electric Comprehensive Operating Supervisor / System), with AT & T in Bells Lab when Multics was withdrawn some of the programmers named Ken Thompson and Dennis Ritchie decided to rewrite operating system in order to support low cost computer..To Know More

    CLICK HERE

  • MICROSOFT

    MICROSOFT:Microsoft was established to develop and sell BASIC interpreters for the Altair 8800. It rose to dominate the home computer operating system market with MS-DOS in the mid-1980s,followed by the Microsoft Windows line of operating systems. To Know More

    CLICK HERE

  • CISCO

    CISCO:During the early 1980s, there was a married couple namely Len and Sandy Bosack who used to work in two different departments of computer located in Stanford University. This couple was facing problem in making their computers communicate with each other To Know More

    CLICK HERE

showinfo=1

User and Group Management


User and Group Management



1. USER:- All linux user have a used ID and a unique numeric identification number called User Id (UID).

Every user of the system is assigned a unique User ID number. User’s name and UID are stored in  /etc/passwd. User are assigned a home directory and a program that is run when they log in (usually called shell). Users can not read, write or execute  each other files and directory without permission.



Types of User                         User ID

1. Superuser                             0

2. System User                         1-499

3. Normal User                         500-60000



2. GROUP:- All Linux users have a group ID and a unique numeric identification number called Group Id (GID). Users are assigned to group with unique Group ID number. GID are stored in /etc/group file. Each user is given their own private group, they can also be added to other groups to gain the additional access  of a particular file or directory. All users in a group can share files that belong to the same group.

When a user is get created in linux its entry is recorded in the following files.

1. /home

2. /etc/passwd

3. /etc/shadow

4. /etc/group

5. /etc/default/useradd

6. /etc/login.defs



1. /home :- this is a user default home directory except root user and the command to view the users from home directory is :-

[root@server1~]# cd  /home              

[root@server1  home]# ll or ls            



2. /etc/passwd :-  user account information is store in this file and it contains 7 filed. And  the command to view the user account information is :-

[root@server1~]# cd /etc                    
[root@server1  etc]# cat   passwd          



1.linus = username
2.  x = password ( its indicate that password is set for a user)
3. 501 = uid
4. 501 = gid
5. : : = user information (GECOS = General  Electronics COmprehensive System)
6. /home/linus = user’s home directory

7. /bin/bash = user’s default  log in shell or shell type


To add user information in GECOS filed the command is :-
[root@server1~]# chfn  username      
Name [] : Linus Torvald                    
Office [] : Vashi Plaza, Navi Mumbai , Setcor-17.                  
Office Phone [] : 022-323646569/70 
Home Phone [] : 022-12345678                     

Figure information changed.
[root@server1~]#cat  passwd
Linus:x:501:501:Linus Torvald, Vashi Plaza,Navi Mumbai,Sector-17,022-323646569/70,022-12345678:/home/linus:/bin/bash        

3. /etc/shadow :- Secure user account information is stored in this file and it contains 9 filed. And the command to view the secure user account information is :-
[root@server1~]# cd /etc                    
[root@server1  etc]# cat   shadow          

 
1. linus = username
2. $78$xgfyryioruo$/df0 = user password in encrypted form (MD5 – Message Daigest)
3. 14763 = Date of last password change
4. 0 = minimum password age
5. 99999 = maximum password age
6. 7= worning before password is expired
7. : : =password inactivity period
8. : : = account expiration date
9. : : = reserved filed

4. /etc/group :- User group account information is stored in this file and it contains 4 filed. Andthe command to view the user group account information is :-
[root@server1~]# cd /etc                    
[root@server1  etc]# cat   group          


1. linus = username or group name log in with
2. x = password ( its indicate that password is set for a user and if it is black no password has been set)
3. 501 = group GID
4.:: = members of the group, if it is blank no member has been added to the group
5. /etc/default/useradd :- Default value or a default log in shell script is store in this file for a new user. You can change the value from it and while changing the value from this file existing users value will not be change. And the command to view the this script is :-
[root@server1~]# cd /etc                    
[root@server1  etc]# cd /default                    
[root@server1 default]# cat  useradd              
# useradd defaults file
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes

1. GROUP=100  = this indicate the user type
2. HOME=/home  = defines the directory where user's home directory is created by default.
3. INACTIVE=-1  =  active user account and allow to user login, if it is 1 user will not able to log in
4. EXPIRE=  user account expires days can be set
5. SHELL=/bin/bash  = default user bash shell
6. SKEL=/etc/skel = defines the path of the director which contains the files and directories which are copied to the users home directory when the user login is created. Here you can place additional files and directories, which you want to be copied to users home directory, when user is created.
7. CREATE_MAIL_SPOOL=yes  = define the directory where user’s mails will get stored by default.

6. /etc/login.defs :- This file defines user password details, uid, gid,  and mail directory location. And the command to view the this script is :-
[root@server1~]# cd /etc                    
[root@server1  etc]# cat login.defs                

User and Group Management Tutorial.

1. To create a user.
[root@server1~]# useradd  username                         
[root@server1~]#cd /etc                                 
[root@server1 etc]#cat passwd                                   

2. To set password for new and existing user.
[root@server1~]# passwd  username                          
Changing password for user username.
New password: * * * * *
BAD PASSWORD: it is based on a directory word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication token updated successfully.

3. To create a group.
[root@server1~]# groupadd  groupname        
[root@server1~]#cd /etc                                 
[root@server1 etc]#cat group                         

4.  To add existing user to a group.
[root@server1~]# usermod  -G groupname  username                       
[root@server1~]#cd /etc                                 
[root@server1 etc]#cat group                         

5.  To add new user to a Secodary group.
[root@server1~]# useradd  -G groupname  username                         
[root@server1~]#cd /etc                                 
[root@server1 etc]#cat group                         

6.  To add newly created user to a Primary group.
[root@server1~]# useradd  -g groupname  username              
[root@server1~]#cd /etc                                 
[root@server1 etc]#cat group                         

7.  To remove user from a group.
[root@server1~]# gpasswd  -d  username  groupname                       
Removing user username from group groupname

8.  To remove user password.
[root@server1~]# passwd  -d  username                     

Now login with that user in another console
Press CTRL+ALT+F2
Server1 Login: username                                
username@server1~]$

9. To create user without password.
[root@server1~]# useradd  username             
[root@server1~]# passwd  -d  username                     

Now login with that user in another console
Press CTRL+ALT+F2
Server1 Login: username                                
[username@server1~]$

10. To delete a user.
[root@server1~]# userdel username               
root@server1~]#cd /etc                                              
[root@server1 etc]#cat passwd                                   

11. To delete a user along with its files forcefully.
[root@server1~]# userdel –rf  username                    
root@server1~]#cd /etc                                              
[root@server1 etc]#cat passwd                                   
[root@server1 etc]#cd /home                         
[root@server1 home]#ll                                              
[root@server1 home]#cd /var/spool/mail                    
[root@server1 var]#ll                                     

12. To delete a group.
[root@server1~]# groupdel groupname                      
root@server1~]#cd /etc                                              
[root@server1 etc]#cat group                         

13. To lock user.
[root@server1~]# usermod  -L  username      
Now login with hat user from another console
CTRL+ALT+F2
Server1 Login : username       
Password: ******                  
Login incorrect

14. To unlock user.
[root@server1~]# usermod  -U  username                  
Now login with hat user from another console
CTRL+ALT+F2
Server1 Login : username       
Password: ******                  
[username@server1~]$

15. To change username.
[root@server1~]# cd /etc                    
[root@server1 etc]# cat passwd                      
[root@server1 etc]#usermod  -l      oldusername                   
[root@server1 etc]# cat passwd                      
[root@server1 etc]# cat group            
[root@server1 etc]#id  username        
uid= username  gid= groupname  groups= groupname

16. To change user UID.
[root@server1~]# cd /etc                    
[root@server1 etc]# cat passwd                      
[root@server1 etc]#usermod  -u      username 
[root@server1 etc]# cat passwd                      
[root@server1 etc]# cat group            
[root@server1 etc]#id  username        
uid= username  gid= groupname  groups= groupname

17. To change groupname.
[root@server1~]# cd /etc                    
[root@server1 etc]# cat group            
[root@server1 etc]#groupmod  -n  newgroupnmae   oldgroupname   
[root@server1 etc]# cat group            

18. To change group GID.
[root@server1~]# cd /etc                    
[root@server1 etc]# cat group            
[root@server1 etc]#groupmod  -g      groupname                     
[root@server1 etc]# cat group            
[root@server1 etc]# cat passwd                      








CONFIGURING DHCP ON ROUTER


Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ip dhcp pool Test
Router(dhcp-config)#network 20.0.0.0 255.0.0.0
Router(dhcp-config)#default-router 20.0.0.1
Router(dhcp-config)#dns-server 192.168.40.73
Router(dhcp-config)#exit
Router(config)#ip dhcp excluded-address 20.0.0.1
Router(config)#ip dhcp excluded-address 192.168.40.73


Now we have to check the dhcp client

first click on any client PC, you will get following screen



Now click on the ip configuration tab, you will get two options static and dhcp


select dhcp option and you are done.


to verify in router do follpwing

Router#sh ip dhcp binding
IP address       Client-ID/              Lease expiration        Type
                 Hardware address
20.0.0.4         000B.BE90.794B           --                     Automatic



Booting Process


Booting Process



1) POST (Power On Self Test):- BIOS is group of program and it is written by system programmer to do the POST so it checks the hardware and put the list on memory chip.

2) CMOS (Complimentary Metal Oxide Semiconductor) :- CMOS comes with motherboard and has program in it, we can make changes in. CMOS battery powers the CMOS data which is inside it and to access CMOS data we have to press DEL key or other appropriate key for it.

BIOS reads CMOS and the CMOS in the RAM :-
RAM=BOIS+CMOS
CMOS:- Why you called me?
BIOS:-To load OS.
CMOS:- Who asked?
BIOS:- CPU
CMOS:- Which OS?
BIOS:- Any (then BIOs checks Boot Priority)
CMOS:-  Ok go to the first boot device.
In the first boot device it looks for MBR, it is located at CHS(Cylinder-0, Head-0, Sector-1)

MBR(Master Boot Recorder), MBR is divided into three part:-
1. Boot Partition (446 Bytes)
2. Partition Table (64 Bytes)
3. Magic No. (2 Bytes)


In the system BIOS check the  system  and launches first stage boot loader on the MBR of primary hard disk. The first stage boot loader load itself into memory and launches the second boot stage boot loader from first boot partition.
The first stage boot loader it’s a small machine code on the MBR and its job is to locate the second boot stage loader and load first part into memory once the second boot stage loader is in the memory its resent the user with graphical screen showing different OS and kernel, it has been configured to boot the graphical screen comes because of /etc/grub.conf script which is a link file and actual stored in /boot/grub/grub.conf.

Over here user can use arrow keys to choose which OS or kernel they which to boot and press enter, if  no keys are pressed the boot loader loads the default selected OS after the configuration period has passed.
Now once the second stage boot loader has determine which kernel to boot it locates the corresponding kernel binary ( /boot directory) the kernel binary named used the following format which is located in /boot directory
vmlinuz

After selecting OS the kernel is loaded and CPU immediately initialized and configure computer, memory and various hardware attached to the system including all process, input & output system and a storage devices. Then it look for a compressed init.ramfs image in predetermined location in memory. It compresses it directly to /sysroot then it loads all necessary drivers.
Now the init program starts and coordinate the rest of booting process and configure the environment for user. Init is father of all other process and its PID is 1.

When init program start it become parental and grant parent for all other process and all the processes start automatically on that system. Then it first run /etc/rd.d.rc.sysinit script which states the environment path starts the swap memory checks the file system execute all other steps required for system initialization. Then the init command runs /etc/inittab script which describes how the system should be set up in init each runlevel, run levels are more defined by services list.
RUNLEVELS are
0 – Halt
1 – single user mode
2 - Multiuser without NFS
3 – Full multiuser
4 - Unused
5 – X11
6 – Rebbot

The init command sets the source function library /etc/init.d/functions script. First system to start, kill and determine the PID of program. The init start all the   processes by looking appropriate rc directory from the runlevels specified as default in file /etc/inittab.
For example when booting to runlevel 5 the init looks in /etc/rc.d/rc5.d script to determine which process to start and stop.
All the files in the /etc/rc.d/rc5.d are symbolic link tp script located in /etc/rc.d/init.d. the name of each symbolic link begain witj k or s where k links are process that kill on runlevel while those beginning with s are started.
After the init command has processed to rc directory for runlevel in /etc/inittab files it directly point to /sbin/mingettys process for each virtual console.
The /sbin/mingettys process opens communication path way to tty devices. Set there mode print a login prompt except the username and password and initialize the login screen.
 



For Latest Updates: Subscribe Now | | Test Your Knowledge, Take a Quiz now Click Here | | Site Best Viewed In Firefox

X