Sunday 23 August 2015

2. Redhat Linux : RHCE 6

2. Redhat Linux : RHCE 6

 
 
Linux Booting Process:


Power on ---> SMPS ---> BIOS ---> Processor ---> POST ---> Peripeherals & MBR (446B of boot info + 64B of partition info + 
2B OS Sign) ---> GRUB(Grand Unified Boot Loader)(GRUB Stage 1, Stage 1.5, Stage 2) ---> /etc/grub.conf ---> /etc/inittab --->
/etc/inittab ---> /etc/rc.d ---> /etc/rc.d/rc5.d ---> /etc/rc.d/rc.local ---> Login Shell 


POST:
----
* Power On Self Test is the process where the processor check itself.
* After that two process occurs, including MBR and Peripherals check

MBR :
---
* Master Boot record = 512 Bytes
* MBR contains information about booting, partitions and OS signature

GRUB :
----
* GRUB stage 2 hits the /etc/grub.conf file which stores the kernel information.

/etc/grub.conf :
--------------
* default=0 is the default kernel number to load.
* timeout=5 is the timeout to select the kernel in Secs.
* vmlinuz is the kernel image

/etc/inittab :
------------
* Initialization process.
* It selects the runlevel type, id=5:init.default
  Run level types:
   0 Shutdown
   1 Single user(root)
   2 Multi user without NFS
   3 Multi user with NFS
   4 Not assigned
   5 GUI
   6 Reboot

Booting without root password:
-----------------------------
* Boot in single user mode(rescue mode) and change the password(ESC + e + e + 1 + b)
 Interrupt kernel by pressing 'Esc' while booting
 Then goto edit mode by pressing 'e'
 If it is grub password protected type 'p' for giving password
 Then select the kernel and press 'e'
 Then type 1 to goto runlevel 1, that is single usermode.
 Then type 'b' for booting

* Type 'grub-md5-crypt' to encrypt /etc/grub.conf
* Goto /etc/grub.conf
 under hidden menu type 'password --<password given by last command>'

/bin  : normal user executable commands
/sbin : root user
/etc : system config files
/home : default home directory, user datas
/usr : unix system resource files(man pages)
/lib : library files
/dev : device config files(hw related infos) 
/tmp : temporary files(upto 10 days)
/media : removable medias
/proc : kernel related info, command line etc
/opt : third party packages info
/boot : booting info
/var : variable messages

Links :
-----
Softlink
 create a shorcut
 diff inode value
 no memory waste
 once deleted affect other links also but once any link is deleted it wont affect source
 for files only
 ln -s filename linkname
 it wll be listed as l type file
Hardlink
 create a copy of the file
 same inode value
 higher memory utilization
 if any one deleted would not affect the other
 can be used for files and directories
 ln filename linkname
 it wll be listed as - type file

Permissions :
-----------

default for directory : 755 
default for files  : 644

Initial permissions for files   : rw-rw-rw-
umask value is subtracted to get deault value : 6 6 6 - 0 2 2 = 6 4 4 rw-r--r--

Initial permissions for directories  : rwxrwxrwx
umask value is subtracted to get deault value : 7 7 7 - 0 2 2 = 7 5 5 rwxr-xr-x

user -u
group -g
others -o
all -a
read -r,4
write -w,2
execute -x,1
add +
remove -
chmod : to change the basic permissions of files and directories
chown : to change the file ownership
chgrp : to change the group ownership

suid(setv user id) is used for commands  : give 4 for anyone can access the command
guid(group user id) is used for directories : 2 give group members to access newly added childs of the directory
stickybit is used to remove delete permissions : 1 give others all permissions but they cannot delete it

ACL:
---
* Access Control List

setfacl -m u:username:rwx filename  : to give permission to a particular user only
setfacl -m g:usergroup:rwx filename  : to give permission to a particular group only  
getfacl filename    : to get file access control list
setfacl -x u:username filename   : to remove permission given to a particular user only
setfacl -x g:usergroup:rwx filename  : to remove permission given to a particular group only

x - remove
m - modify
u - user
g - group

User administration:
-------------------
Super user uid=0   gid=0
System user uid=1-499 gid=1-499
Normal user uid=500-60000 gid=500-60000

Super User:
 admin
 /root
 /bin/bash
System User:
 system apps
 no home directory
 nologin
 /sbin/nologin
Normal User:
 normal users
 /home/user_name
 /bin/bash

* /etc/passwd stores the user related informations
/etc/passwd conatins 7 fields:
 login ID
 Password place holder
 UID
 GID
 comments
 home directory
 login shell

* /etc/shadoe file stores password related info
/etc/passwd contains 9 fields:
 Login ID
 encrypted password
       ----------------------------------password ageing field
 Last password change
 min
 max
 warning
 Inactive
 Expire
       -----------------------------------
 Reserved field

* useradd -u uid -d /home -c comment -s /bin/bash username
* usermod to modify
* userdel -rf to delete
* groupadd group_name
* gpasswd -a username groupname   : add a user to group
* gpasswd -d username groupname   : delete
* groupdel groupname    : delete group
* /etc/group stores the group related info
* passwd -l username    : to lock the password for any user(!! in /etc/shadow will show locked status)
* passwd -u username    : to unlock the passwd
* chage -l username    : to list user related info
* chage -m min_days -M max_days -W warn_days -I Inactiv_days username
* useradd -g ibm swe    : to create user with primary group ibm
* useradd -G ibm swe    : to create user with secondary group ibm

* sudo  : super user do
* sudo commands are stored in /etc/sudoers

/*
Commands for the day:
--------------------
* chmod
* chown
* chgrp
* setfacl -m u:username:rwx filename
* setfacl -m g:usergroup:rwx filename  
* getfacl filename
* setfacl -x u:username filename
* setfacl -x g:usergroup:rwx filename
* useradd -u uid -d /home -c comment -s /bin/bash username
* usermod to modify
* userdel -rf to delete
* groupadd group_name
* gpasswd -a username groupname
* gpasswd -d username groupname
* groupdel groupname
* passwd -l username
* passwd -u username
* chage -l username
* chage -m min_days -M max_days -W warn_days -I Inactiv_days username
* useradd -g ibm swe    
* useradd -G ibm swe    
*/

No comments:

Post a Comment