Docstoc

system administration

Document Sample
system administration Powered By Docstoc
					                     History of linux
                   ----------------------

What is an Operating system


 Operating system is the collection of programs that
coordinates the operation of computer hardware &
software

functions of operating system:
1)process management
2)memory management
3)Data management
4)I/O management


Arcitecthure of linux
----------------------


Kernel: kernel is a set of functions that makeup heart
of an o/s
it is used to provide application interface between
programs & physical devices
services provided by kernel :


-controls execution of process
-scheduling process fairly for execution on cpu
-Allocating memory for an executing process

shell : shell is an interface between human readable
language & machine language
                   Multics project


  Multics was started by mainframe GE 645 by the joint
effort of

-AT&T bell labs
-general electricals
-Masachusetts Institute of Technology

-Multics was designed in Assembly Language
in 1969 Multics project was dropped


in 1969, AT & T redesigned multics and introduced new
os thai is unics(Uniplex information & Computing
system)

 it is written in 80% of "c" Language and 20% with
assembly language by kenthomson & dennis ritchie
.Later on totally rewritten in "c" language and
renamed as unix(1973)


           flavours of linux

     vendor                     o/s
  -----------        ------------
  AT&T,Bell labs            SYS III -sys V
  SUN              Sun os - Solaris
  SCO              Sco unix
  IBM              Aix
  SG              IRIX
  HP              HP-Aux
  BSD            free BSD linux


        In 1988, AT&T shocked the unix community by
purchasing a percentage of Sun microsystems which
became a threat for other vendors
Quickly the other vendors form a group and named it as
OSF(Open Software Foundation)
and former formed teir group and named it as UI (Unix
International)

   In 1990,Linuz torvalds a graduate student from
Helskiny university designed unix like kernel 386
intel machine and gave it to OSF

   Linux is bundled with many softwares from variuos
distributors and it gave rise to many flavours of
Linux



             No of companies are providing tech
support for linux o/s

            RedHat
            SUSE
            MANDREKE
            NOVEL
            PUPPY LINUX
            TURBOLINUX
            SLACKWARE
            UBUNTU
            KNOPPIX


    name of kernel in RhEl5 is v.m.Linuz 2.6.18-8.el5
    Kernel image is initrd
    installers name is anaconda-ks.cfg
    default shell is /bin/bash
    MBR - Master Boot Record
        MBR's job is to locate compressed kernel &
arrange the architecture logically

default MBR in linux is GRUB : Grand Unified Boot
Loader
    "    "   " windows is ntldr
             features of linux

1)Open Source(along with source code)
2)Multiuser& Multitasking
3)Enhanced Security (Inbuilt firewalls)
4)Reliability
5)GUI
------ Biggest servers on this earth are running on
linux    without restarting from last twelve years


to Download linux o/s

www.redhat.com/Downloads
www.500.org
www.netcraft.com


redhat companies free version is fedora
                 Enterprise version Rhel

RHEL=redhat enterprise linux

                           FILESYSTEM HIRERACHY OF LINUX


"/"
------------------------------------------------------
------------------------------------------------------
---------------
 |             |           |          |         |
|        |        |        |          |          |
|          |           |
/root   /home   /boot   /sbin   /bin    /usr   /var
/dev   /etc    /proc    /tmp    /opt    /media    /lib
                       "/"   this directory is called as
root directory

                        It is the top of filesystem
structure

All other directories are mounted under it.

  (1)     /root : this is default homedirectory of
administrator

  (2)     /home : It contains all users home
directories

  (3)    /boot : It contains bootable files like
kernel  (initrd image), bootloader (GRUB),
                                    installer
(ANACONDA-ks.cfg)

  (4)    /sbin : It contains administrative commands
used by super user (root)
                                 i.e. ADMINISTRATOR

  (5)    /bin : It contains commands used by
superuser & normal user

  (6)    /usr : It contains the packages and
application which are available for user
                       (similar to program files on
windows)

  (7)    /var : It contains variable information such
as logs and print queries

  (8)    /dev : This directory contains devices modes
through which the o/s can access
                               hardware (on software
device on the system)

 (9)     /etc    : It contains all configuration files
 (10)   /proc : This directory contains current
running process information.

 (11)   /tmp : This directory contains temporary
files used by the system

 (12)   /opt   : It contains the third party
application

         Eg     : Core word effect, Sun star office

 (13)   /media: Removable media is stored under this
directory.

 (14)   /lib : It contains libraries need by no. of
different application as well as linux kernel



    DEVICE                                         IDE
SATA

primary master                          /dev/hda
    /dev/sda
primary slave                       /dev/hdb
    /dev/sdb
secondary master                   /dev/hdc
    /dev/sdc
secondary slave                   /dev/hdd
    /dev/sdd




questions on history:

1) what is the name of kernel image in linux?
2) what is the name of installer?
3) who designed linux kernel?
4) if i download an openoffice rpm from internet and
installed into my system where that will be stored.
5) howmuch space an mbr occupies?
6) what is the default shell in linux?
7) what is the name of redhat free version?
8) where will be john users homedirectory?
9) i have installed dhcp package into my system if i
want to learn about dhcp how can i learn?
10) in which partition shell will present?
11) what is the name of bootloader in windows & linux?
12) gnu stands for?
13) which license we have to agree to download linux?
14) what is open source?
15) explain features of linux?




                         Basic commands

1)pwd: present working directory ---> used to know the
pathof present user.
2)ls : list ------>It gives the list of files &
Directories present in the path
3)ls -l or ll --------> Listing of all files along
with attributes
4)ls -a ------> Lists all hidden files & directories
5)ls -r -------> lists all files & directories in
reverse mode
6)ls -il---------> lists all files & directories along
with inode numbers
7)ls -ld < directory name> ------> to view attributes
of a particular directory
8)ls -R <dir.name> -------> to view tree structure of
a directory
9)ls -a* ----------> to view all files & directories
starts with a
10)man < command> ---------> to view entire options of
a command
11)info < command> -------->   "                "
"



to create a file we have 3 methods
1)touch
2)cat
3)vi


1) touch : with the help of touch command we can
create an empty file.
syntax: touch < filename>
ex: touch ds
with this command we can create n number of files at a
time.
syntax: touch <file1> <file2> <file3>
ex: touch sun moon stars


2)cat: by using cat we can create datafiles
syntax: cat > <filename>
cat > deepu
(edit data)
(ctrl+d)(to save)

to view content of a file
cat < filename>


to add data in existing file
cat >> <existing filename>
(typedata)
(ctrl+d)

we cannot edit the written text through cat command
.we can only add data
to modify existing data we have to use editors.
we have number of editors in linux
ex: gedit,nano,kedit,kate,emacs

but we always use the best editor vim editor

we can transfer an output as input for another file
ex: to view output of file1 file2 we use cat file1
file2
in the same way we can transfer output of that command
as input for another file
ex: cat file1 file2 > file3
here we are giving file1 file2's data as input for
file3
by this data of file1&file2 will copied into file3

                   vi-editor
                ---------------
in vi editor we have 3 modes :
1)command mode
2)insert mode
3)execute mode

in command mode we can
copy,paste,delete,undo,redo,move,save&quit
in insert mode we can only edit data
in execute mode we can set line numbers,delete line
numbers,save&quit,quit with out saving,substitute data


when ever we type vi <filename>
if the file is there it will edit the existing file
if the file is not there it will create a new file
by using vi <filename> it will enter into command mode

to   go to insert mode from command mode
i:   insert text at current cursor position
I:   insert text at the begining of cursor line
a:   append text after cursor position
A:   append text at the end of cursor line
o:   create a new line below cursor line and append text
O:   create a new line above cursor line and append text
s: it removes cursor presented character and append
data



to move from insertmode to command mode press "esc
key"

command mode :
-------------
dd: to delete a line
5dd : to delete five lines
yy: to copy a line
5yy: to copy five lines
p: paste
10p : paste 10 times
u:undo
ctrl+r :redo
shift+g or G : to move last line of a file
gg :to move first line of a file
10g :to move 10th line of a file
shift+zz : save&quit


to move into execute mode from command mode press
shift+:

execute mode
--------------
q: quit with out saving
q!: quit with out saving forcefully
wq: save&quit
x: save&quit
wq!: save&quit forcefully
:/<word> : to serach for a particular word
ex: /sun : searching for a word sun in the file
:15 :to jump into 15th line of a file

set nu: to set line numbers for a file
set nonu: to remove line numbers of a file
          substitution
        ------------------
syntax: <begingline>,<endingline> s
/<oldchar>/<newchar>/g
ex: if i want to change LABEL as SMS in /etc/fstab
1,$ s/LABEL/SMS/g
here 1,$ indicates from first line to lastline
s for substitute
LABEL is old charcter
SMS is new character
g for grouping


note:    to set automatic line numbers
-------
 crate a hidden file as follows in /root

vi .vimrc
(type) set nu
save& quit

to create hidden files in linux use . at the begining
of filename
ex: cat > .sun
now .sun is a hidden file

clear : used to clear the screen or use ctrl + l
to get more help for vi editor
type vimtutor

               file prompting commands
               -------------------------
head: used to view first ten lines of a file
syntax: head <filename>
ex: head /etc/passwd
to view 5 lines of a file
head -n <no of lines> <filename>
ex: head -n 5 /etc/passwd
tail : is used to view last ten lines of a file
syntax: tail <filename>
 ex: tail /etc/passwd
to view last 20 lines of a file
tail -n 20 /etc/passwd

more : used to see the content pagewise but we cannot
scroll up
syntax: more < file name>
ex: more /etc/passwd

less: used to see the content pagewise we can scroll
up&down
syntax: less <filename>
ex: less /etc/passwd


date: used to view current date&time

to change date
date <mm-dd-hr-min-year>
ex: date 120111452008
it means 12th month
01 date
11:45 11 hours 45 minutes
2008 year

or

date -s <content>
date -s "wed june 20 20:46:51 IST 2008"

cal : cal is used to view present months calender
cal
 to view a particular month,particular years calender

cal <Month> <year>

cal 3 1983 -------------> to view march 1983 calender
cal 2000 ----------------> to view entire 2000 year
calender


| --------> this symbol is called as pipe    it is used
to link conmmands

ex: ls | grep pot

grep : is used to skip something specially from the
output

here in example from output of ls we are grepping pot

ll | grep "^d" ---------> here from     the out put of ll
we are greping only directories



mkdir <directory name> -----> to create a directory
ex: mkdir sun
to create multiple directories
mkdir <dir1> <dir2> <dir3>
ex: mkdir sun moon stars

to create nested directory

mkdir -p <dir1/dir2/dir3>
mkdir -p sun/moon/stars

to change the directory
cd < path of directory>

to   change directory one level back
cd   ..
to   change directory two levels back
cd   ../..


      removing a file or directory
to remove a file
rm <filename>

to remove an empty directory
rmdir <dir.name>

to remove directory recursively & forcefully

rm -rf -> to delete directory with out asking yes or
no


           copying a file

cp <sorce> <destination> -----> to copy   a file
ex: cp file1 /etc/

cp -rf <source > <destination> ---> to copy entire
directory along with subdirectories & files
ex: cp -rf sun /ds/dawn
cp -a <source> <destination> -----> to copy a file or
directory along with permissions
ex: cp -a Server /var/ftp/pub


to move a file or directory
mv < source> <destination>

mv deepu   /sun/moon

to rename a file or directory
mv <oldname> <newname>

to create chain commands

 in linux we can execute "n" number of commands    at a
single command line

syntax: command1;command2;command3;
ex: date;cal2008;date 120111452008;mkdir manju;cd
manju;cd


lab questions

                     basic commands lab


                                  one
                                   |
                      -------------------------------
                    two           three             four
                     |        |                |
                -----------      ---------         -----
-------
               |            |          |              |
|
              five          six    nine         ten
thirteen    fourteen
               |               |       |         |
|
               file3       -------     file2 ---------
-----------
                           |       |        |              |
|          |
                          seven    eight   eleven         twelve
fifteen    sixteen
                                                  |
                                                file1


create this structure from /
1) move /one to /root
2) go to seven
3) copy sixteen to five
4) move file2 to seven
5) go to twelve
6) remove file2 from seven
7) create a new file name velvet under /usr
8) copy file1 into /king
9) edit into /king
10) copy a line and paste 100 times
11) replace /king with /etc/passwd
12) change date to january 1 1983
13) chain a list of commands as follows
    a) show all hidden files in /root
    b) show date
    c) create a directory fun under /root
    d) enter into that directory
    e) must present under /root
14) Display first five lines of /etc/fstab
15) what are the commands used to view entire content
of a file
16) redirect 1983 decembers calender into /volvo
17) go to /
    a) show tree structure of one with out using
pagedown
18) create a nested directory under
/var/bus/truck/van/car
19) list out only directories in /root



                            sun
                             |
                     ------------------
                     |                 |
                   moon             stars
                     |                   |
                 -----------        ----------
                 |          |       |          |
               mars    jupiter  bsc        bcom
                 |                             |
                file1                        file3
                file2                        file4

1)go to mars
    a)copy file1 to bsc
    b) move file4 to mars
    c) copy bcom to jupiter
2)go to bsc
    a)copy file2 to bsc
3)create a directory flower in /
4)remove bcom with files
5) create a nested directory in /tenth/inter/degree/pg
6) copy /etc/fstab to /a
    a) set line numbers
    b)copy 5,6 lines and paste below
    c) remove 5,6 lines
    d) substitute LABEL with MMS
    e) quit after save
7) reenter into /a
    a)make changes in 7th line
    b)quit with out saving
8)show tree structure of sun from /
9) show hidden files in /root
10) create 2 files file1 & file2
11) transfer file1 & file2's data into file3
12) longlist only sun
13) view first fifteen lines of /etc/passwd
14) open /a file
    a)directly search for /root
    b)directly go to line no 8
15)go to /root then remove jupiter from sun directory
16) try to login in different consoles
17) change no.of desktops as 10
18)shutdown the system from tui.




umask : umask is the value with this umask mask value
kernel can identify who is going to create a file or
directory.

umask is the command to find out umask value
root users umask 0022
normal users umask 0002

default permissions = maximum permissions-umask

root
       max.per of a file 666
                umask    022
                       --------
                         644


normal user

       max.perm of a file 666
              umask       002
                        -------
                          664


for a directory

root
max.permisssions for a directory     777
                        umask        022
                                   -------
                                     755
normal user
max.permisssions for a directory    777
                       umask        002
                                   -----
                                    775

  we can change permissions in two methods

1) symbolic mode
2) absolute mode (numeric mode)
1)symbolic mode
-----------------
 users            permissions       operators
--------                -------------            -------
-----
u=owner(user)          r=read      +
g=group      w=write       -
o=other      x=execute     =


chmod is the command to change permissions
syntax: chmod <permissions> <file or dir name>
ex: chmod u=rwx,g=rx,o=rx ds
(here we are giving full permissions to
owner,read&execute for group & others


if we want to change permissions for a specific task

ex: here i want to give write to group

chmod g+w ds


2)absolute mode:
          In Absolute mode we have to provide
permisions in numeric signs

r=4
w=2
x=1
syntax : <permissions of owner,group,other> <filename>
chmod 755 ds
here we are giving full permissions to owner &read
execute to group & others

if we want remove total permissions for others
chmod 750 ds
                  ADVANCED FILE PERMISSIONS
                --------------------------------

We have three advanced file permissions.
1)suid
2)sgid
3)stikybit

1)suid :4
2)sgid :2
3)stickybit:1

suid: suid will be apply only on commands suid is used
to provide root previlages on a particular
administrative command for a normal user
ex: ls -l /bin/ping
In this example by default suid was applied for ping
command thats why anybody can use ping command if we
remove ping command nobody can use
check : chmod 755 /bin/ping
now try to ping from any user account(it wont ping)
provide suid then ping once again
(providing suid chmod 4755 /bin/ping )


SGID : It is an advanced file permission for group
inheritance. parent dierctory group is inherited to
all files and directories.
SYNTAX : chmod g+s <filename>
ex     : chmod g+s /redhat

STICKYBIT : stickybit is an advanced file permission
through which owner and root can delete his file and
no other users to allow to delete files
SYNTAX : chmod o+t <file name>
ex      : chmod o+t /redhat
   Hardlink                                 soft link
 -------------                            -------------
---------
1)can create accross the partitions.         1) can
create only with in a partition
2) Inode number will be same.              2)Inodes
numbers are different.
3) original & link file are in same size.       3)link
file size is less than org.file.
4) if original file removed then also we can    4)link
file can't be accessed if
   access link file.                       original
file is removed.

TO CONFIGURE HARDLINK
----------------------
SYNTAX :ln <source file><destination file>
ex : ln /dev/sda /dev/sdb

TO CONFIGURE SOFTLINK
----------------------
SYNTAX : ln -s <source file><destination file>
ex : ln -s /usr/king /root/redhat




                ACL (Access Control Lists)
            ----------------------------------
     To configure different set of file permissions
for different users on a single resource
(files/folder) Acls are implemented
Acls can be applied on users and groups
To apply an Acl for an user

SYNTAX : setfacl -m u:<username>:<permissions> <file
or directory name>
ex : setfacl -m u:john:rwx /redhat


To check acls of file or directory
SYNTAX :getfacl <file or directory name>
ex : getfacl /redhat

To apply an acl for a group
SYNTAX : setfacl -m g:<groupname>:<permissions> <file
or directory name>
ex : setfacl -m g:sales:rwx /redhat

To Remove acl
SYNTAX :setfacl -x u:<username>: <file or directory
name>
ex : setfacl -x u:john: /redhat
ex : setfacl -x g:sales: /redhat



lab questions



          File permissions lab
        --------------------------
1)create a file monsoon as root
2)check permissions
3)change permissioons of monsoon as follows(symbolic
mode)
    a)owner can read,write,execute
    b)groupmembers can read,write,execute
    c)others do not have any access
4)create a directory car under /
5)modify cars permissions as follows(numeric mode)
    a)owner can read,write,execute
        b)group members and others do not able to
write but they can read

6)create a directory /mechanic
7)group ownership of /mechanic must be sysusers
8)user sam,john can able to create directories or
files under /mechanic
9)what ever the files created by sam and john those
files groupownership must be sysusers
10)create an user david
11)david must have read,write access on
/mechanic/autocad
12)copy /etc/fstab /usr
    a)file should be own by root
    b)groupownership should be sysusers
    c)user david must have read access but he can't
able to write
        d)user neo can neither read nor write
13)create a group hr with users as sam,neo,mary
    a)they can access each others files under /redhat
    b)groupownership of files created by any user
must go to group
    c)one cannot delete each others files
14)allow all users to modify file permissions
15)restrict users to switch user into others accounts
16)allow sysusers groupmembers to write in /redhat
17)create a group dos having users as sam,david
    a)user neo do must have primary group as dos
18)delete sam from dos group
19)delete user david with his uid&homedirectory
20)create a workspace for dos groupusers under / with
a name spin
21)apply an acl for hr group members to write under
/spin
22)remove hr group users access on /spin
23)delete dos group
24)add a group sales
25)add existing users sagar,sujatha,suma into sales
group as secondary group members.
26)create a file maaza under /redhat as sam
27)change ownership of maaza to neo
28)how a kernel find out whether file or directory
created by user or root
29)what is the umask of root & normal user
30)what is the principle for default permissions


USER AND GROUP ADMINISTRATION

/etc/passwd : contains user information
/etc/shadow : contains users password information
/etc/group : contains groups information

cat /etc/passwd : to view total users info
cat /etc/passwd | grep sam (or) getent passwd sam :
to view only sam users information
cat /etc/shadow : to view passwords of all existing
users
cat /etc/shadow | grep sam (or) getent shadow sam : to
view only sam users password
cat /etc/group : to view all groups information
cat /etc/group | grep hr (or) getent group hr : to
view only hr group information.

useradd <option> <username>

-u : TO change uid
syn: useradd -u <uidno> <username>
ex: useradd -u 1000 manohar

-g : to add an user into a group(with out primary
group)
useradd -g <groupname> <username>

ex: useradd -g cyber hari
-G :to add an user into a group(with primary group)
useradd -G <groupname> < username>

-s :to change shell
useradd -s <shell> <username>
/sbin/nologin: user can't able to login from this
pc(he can login from remote pc)
syntax: useradd -s /sbin/nologin admin
/bin/false : user can't login from this pc from remote
pc
useradd -s /bin/false <username>
-d : to change home directory of an user
syntax:useradd -d <home dir place> <username>
useradd -d /usr/manju manju

to modify an existing users account


usermod : usermod is the command to change
modifications to an exisiting user account.

usermod -u <username> : to change uid of an existing
user
usermod -G <groupname> <username> : to add an user
into an existing group along with his primary group
usermod -g <groupname> <username> : to add an existing
user into an existing group with out his primary group
usermod -d <home directory> <username> : to change an
existing users home directory.
usermod -s <shell> <username> : to change shell for an
existing user

gpasswd -a : to add an user into ennumber of groups
syntax: gpasswd -a <username> <groupname>
ex: gpasswd -a sam hr
here we are adding sam into hr group

gpasswd -d : to remove an user from a group
syntax: gpasswd -d <username> <groupname>
ex: gpasswd -d sam hr
here we are removing sam from hr group

gpasswd -M : to add ennumber of existing users into a
group along with primary group.
syntax: gpasswd -M <user1>,<user2>,<user3> <groupname>
ex: gpasswd -M sam,john,mary,neo hr
here we are adding sam,john,neo,mary into hr group

userdel -r : to delete an user account
syntax: userdel -r <username>
ex: userdel -r sam (here we are deleting user sam)


group: group is nothing but logical grouping of users

groupadd : this is the command to add a group
syntax: groupadd <groupname>
ex: groupadd cyber

groupdel : groupdel is the command to remove a group.
syntax: groupdel <groupname>
ex: groupdel cyber (here we are deleting cyber group).

groupmod : used to modify an existing group.
options:
-n : to change name of a group
syntax: groupmod -n <oldname> <newname>
ex: groupmod -n linux solaris

chgrp : chgrp is the command to change group ownership
of a file or directory
syntax: chgrp <groupname> <file or dir name>
ex: chgrp hr /java
here we are changing groupownership of /java to hr
group

chown : chown is the command to change ownership of a
file or directory
synax: chown <username> <file or dir name>
ex: chown sam /java/ruby
here we are changing ownership of /java/ruby to sam

chown -R :to change ownership & groupownership of a
file or directory
syntax: chown -R <owner:groupowner> <file or dir>
ex: chown -R sam:cyber /java/ruby
here we are changing ownership of /java/ruby to sam &
groupownership to cyber group


CHAGE

                 CHAGE

    Chage is used to change passwd policies of an user

To list users password age settings
#chage -l <user name>
ex:chage -l sagar

To set minimum password age:
#chage -m <no. of days> <username>
ex: chage -m 5 sagar

To set maximum password age:
#chage -M <no. of days> <user name>
ex: chage -M 10 sagar

To set inactive status of an account:
#chage -I <no. of days> <user name>
ex: chage -I 3 sagar

To set warning of password expire:
#chage -W <no. of days> <user name>
ex: chage -W 2 sagar

To set account expire:
#chage -E <date of expire in yy-mm-dd format> <user
name>
ex:chage -E 2008-12-01 sagar
To set an account as never expire
#chage -E -1 <user name>
ex:chage -E -1 root

                  PASSWORD LOCKS

To lock an users password:
#passwd -l <user name>
ex: passwd -l sagar

To unlock users password:
#passwd -u <user name>
ex: passwd -u sagar

To deny users password:
#passwd -d <user name>
ex:passwd -d sagar

To reset deny users password:
#passwd <denied user name>
ex: passwd sagar

  lab questions   :


                 user&group admin lab
         ------------------------
1)add an user sam with a password redhat
2)check uid of sam
3)check passwd of sam
4)add a group sales
5)add sam into sales group
6)create an user john into sales group with out his
primary group
7)create an user mary with a home directory under /var
& check it
8)restrict mary to login into your system(she can
remotely login)
9)create three users sagar,suma,sujatha into a group
marketing
10)remove suma from marketing
11)add user sagar into sales group
12)create a workspace with a name java under / for
sales group
13)sales group users can access each others files.
14)create an user mano with out an interactive login
into your system
15)modify an users sams account as follows
    a)uid must be 1000
    b)home directory must be under /usr
    c)he cannot able to login into ur system
16)create a group linux
17)rename linux group as solaris
18)what is the encryption followed by linux to encrypt
passwords
19)where the user information will be stored
20)where the password information will be stored
21)how many types of users are there
22)what is the uid of root user
23)how many users we can add for a server
24)what are the defaults created when an user was
created
25)where will be the mailbox for sam user


                 ATTRIBUTES

    We have two types of attributes
(1)Para attribute
(2)Fully attribute
1)Para attribute:by adding this para attribute to a
file we cannot edit into a file but we can send echo
requests.

syn: chattr +a <file name>
ex: chattr +a /redhat/sun

To send echo request:
syn: echo <"data"> >> <file name>
ex: echo "hello" >> /redhat/sun

To findout whether attribute apply or not:
Syn: lsattr <file name>
ex: lsattr/redhat/sun

To remove para attribute:
syn: chattr -a <file name>
ex: chattr -a /redhat/sun

To apply fully attribute:
syn: chattr +ai <file name>
ex: chattr +ai /redhat/sun

    We cannot send echo messages also into this file

To findout attributes on a file:
syn: lsattr <file name>
ex: lsattr /redhat/sun

To remove full attribute:
syn: chattr -ai <file name>
ex: chattr -ai /redhat/sun


                               DiskManagement
                         -------------------
fdisk -l : is the command to view current partitons



 device info will present under /dev

/dev/sda :

ide ---------------1)primary master------------------
/dev/hda
                   2)primary slave-------------------
/dev/hdb
                   3)secondary master----------------
/dev/hdc
                   4)secondary slave-----------------
/dev/hdd

sata--------------1)primary master------------------
/dev/sda
                  2)primary slave-------------------
/dev/sdb
                  3)secondary master----------------
/dev/sdc
                  4)secondary slave-----------------
/dev/sdd

we can create 4 primary partitions and eleven logical
partitons in a harddrive.(SATA)


fdisk : is the command to create partitions.
syntax : fdisk /dev/<drive>
ex: fdisk /dev/sda
n : for new partition
(if we want to create a new primary partition already
existing primary partitions will be deleted.
so we will go for logical partitions)
l : logical
(we can't able to specify space in inodes )
press enter
(provide size of partition)
+200M(here our partition size is 200 mb)
w: to save partition and write to partition table


partprobe: Is the command to update kernel with out
reboot.


to format a partition ( linux file system is ext3)

mkfs.ext3 /dev/<partition no>
ex: mkfs.ext3 /dev/sda13
        (or)
mke2fs -j /dev/sda13 (along journaling)



df -h : is the command to view mounted partitions
along with mount points & free space


mounting : mounting is a process to create a logical
way to enter a partition

mkdir /redhat (mount point for drive)
mount :is the command use to view mounted partitions &
to create mounting.
syntax: mount <partition> <mount point>
ex: mount /dev/sda13 /redhat

umount : is the command to clear mounting way.
syntax: umount < mountpoint>
ex: umount /redhat


to mount a partiton permanently
we have to edit configuration file
/etc/fstab


vi /etc/fstab

add a line at the end

<partition> <mountpoint> <filesystem> <permissions>
<fsck>
fsck: filesystem consistency check
if fsck is 1 1 only root can access
if fsck is 1 2 any body can access
if fsck is 0 0 only system can access
ex:

/dev/sda13    /redhat   ext3     defaults      1 2
    |            |        |        |          -------
    |            |        |        |            |
partition    mountpoint    file permissions   fsck



                  LABELING
             ----------------------
To assign a label
--------------------
#e2label <partion> <labelname>
ex : e2label /dev/sda13 /songs

To view existing label
-----------------------
#e2label <partition>
ex : e2label /dev/sda13

To see mounted partition with label
------------------------------------
#mount -l


         CREATION OF SWAP PARTITION
    --------------------------------------------
SYNTAX : fdisk /dev/sda
n(for new)
specifu size (Ex : +100M)
t (for toggling)
specify partition number
type 82(code for linux swap)
w (save and write in to partition table)
partprobe (to update the kernel without reboot)

SYNTAX : mkswap <partition>
ex : mkswap /dev/sda13
To enable swap on the swap partition
--------------------------------------
SYNTAX : swapon <partition>
ex : swapon /dev/sda13

To check the status of swap
----------------------------
SYNTAX : swapon -s partition
ex : swapon -s /dev/sda13

To disable swap partition
--------------------------
SYNTAX : swapoff <partition>
ex :swapoff /dev/sda13


                MOUNTING REMOVABLE DEVICES
         ---------------------------------------
To mount floppy drive
----------------------
# mount /dev/fd0 /mnt(mountpoint)

To mount cd rom
----------------
# mount /dev/cdrom /mnt(if mount point is not there)

To mount pendrive
------------------
# mount /dev/sda1 /mnt

To eject the cd rom tray
-------------------------
# eject

to close cdrom tray

# eject -t


To mount tape drive(scsi)
---------------------------
# mount /dev/st0 /mnt

To mount tape drive (ide)
---------------------------
# mount /dev/hto /mnt

To view total free space of a disk
-----------------------------------
# hw browser&

To view free space of partition
--------------------------------
# df -h




Lab questions

1) Create a partition with a size of 200MB that should
be automatically mount on /redhat after   each and
every reboot?
2) give a label for that particular partition as
/songs?
3) copy entire content of /lib into that partition?
4) Show free space of that partition?
5) what is the default ID of Linux partition?
6) what is the command to view partition table?
7) unmount the partition ?
8) create a swap partition with a size of 200MB and
show the status?
9) what is the ID of linux Swap?
10) once again mount the partition on /redhat ?



                           QUOTAS
                       -----------------
 Quota allows Administrator to specify restriction in
two ways :
 1) Restricting a user or a group by creating files in
a specific location.
 2) Restricting a user or a group by the disk space in
a specific location.
    The idea behind quotas is that users are forced to
stay under their disk consumption limit or with number
of files in a particular location.


Quota is handled on a per user, per file system basis.

Quotas are of two types :
   User level quotas      - usrquota
   Group level quotas     - grpquota



to apply userquota

vi /etc/fstab

LABEL=/home       /home   ext3 defaults,usrquota 1 2

(add usrquota beside defaults)

#mount -o remount,rw /home

(to remount /home partition)


to check quotas
#quotacheck -Mc /home


to on quota

# quotaon /home
to set quota for an user

# edquota -u <username>

/dev/sda11          blocks       soft   hard   inodes
    soft hard
         36     0            0             4            0
0



here blocks means the data already present in that
users home directory
soft means at which space u want to send a warning to
user
hard means at which space u want to restrict user to
write into his home directory
note: for both soft&hard we have to add block size
by defaults quotas will be in off mode we have to
manually switchon quotas
#quotaon /home

to check:
1)login as user

type dd if=/dev/zero of=myfile bs=1024 count=10

dd =diskdrive
if = input file (/dev/zero means it's a null file)
of = output file
bs=blocksize(default in bytes)
count= howmany no.of blocks u want to create


to check quota as an admin
#repquota /home


to set users johns quota for user sam
#edquota -p john sam


to work with group quota



 to work with groupquota we have to create quota
enabled partition


create a partition
format with ext3 file system
create a new mountpoint

#mount -o   usrquota,grpquota <mountpoint>

#quotacheck -cugv <qoutamountpoint>

edquota -g <groupname>




repquota


lab questions:

1) create a quota for user alex , when he is going to
create 80MB it should throw warning & if he go for
100MB write must fail?
2) show entire user's quota information?
3) provide user Alex quota to user John?
4) create a quota for user Mary as follows
    i) 50KB must be allow
    ii) 100KB must be restricted
5) turnoff quotas?
6) a partition was already mounted on /redhat make
sure that user John & sam must be able to create files
under /redhat and a file with a name solaris was
created by John restrict all the users included root
to edit or modify in that file (follow below rules)
    a) group ownership of /redhat must be sales
    b) group ownership must be inheritance
    c) one should not delete other's files


            L.V.M(Logical Volume Manager)

LVM is a method of allocating harddrive space into
logical volumes that can be easily resized instead of
partitions.
With LVM the harddrive (or) set of harddrives are
allocated to one or more physical volumes.

    The physical volumes are combined into volume
groups
    Each volume group is divided into logical volumes
which are assigned mountpoints such as /home and
filesystem types such as ext3


To configure LVM
1)Create three LVM partitions
2)Convert them as physical volumes
3)Create volume groups from physical volumes
4)Create logical volumes from volume groups and assign
mountpoints

IMPLEMENTATION:
#fdisk /dev/sda
n
+200M
t
<partition number>
8e
w
partprobe
To convert LVM partitions as physical volumes
#pvcreate /dev/sda<partition numbers>
ex: pvcreate /dev/sda{9,10,11}

To view physical volumes
#pvdisplay

To create volume group
#vgcreate <vg name> <partitions>
ex: vgcreate maaza /dev/sda{9,10,11}

To view volume groups
#vgdisplay

To create a logical volume
#lvcreate -L <+size> <vg name> -n <LV name>
ex: lvcreate -L +200M /dev/maaza -n fanta

To view logical volumes
#lvdisplay

To format logical volumes
#mke2fs -j /dev/maaza/fanta

Create a mountpoint and mount logical volume on it
#mkdir /cyber
#mount /dev/maaza/fanta /cyber
#cd /cyber


To extend size of logical volume
#umount <mountpoint>
#lvcreate -L <size> <lv name>
ex:lvcreate -L +200M /dev/maaza/fanta

To make filesystem for extended size
#resize2fs <logical volume>
ex: resize2fs /dev/maaza/fanta
#mount /dev/maaza/fanta /cyber
To resize a logical volume
note:whenever we are reducing an LVM we have to take
backup
#mkdir /a
#cp -rf /cyber/* /a

#lvreduce -L <-size> <LVM>
ex: lvreduce -L -100M /dev/maaza/fanta

To format LVM
#mkfs.ext3 <logical volume>
ex:mkfs.ext3 /dev/maaza/fanta

#mount /dev/maaza/fanta /cyber
#cp -rf /a/* /cyber

To remove an LVM
#umount <mountpoint>
#lvremove <logical volume>
ex:lvremove /dev/maaza/fanta

To extend volume group
1)create another LVM partition
2)convert into physical volume

#vgextend <vg name> <partition name>
ex:vgextend /dev/maaza /dev/sda12

To reduce volume group
#vgreduce <vgname> <partition name>
ex:vgreduce /dev/maaza /dev/sda12


To remove volume group
#vgremove <vg name>
ex:vgremove /dev/maaza

To delete physical volumes
#pvremove <partitions>
ex:pvremove /dev/sda{9,10,11,12}


lab questions:

1) create a volume group with a name of cyberaegis
whic should contain 3 physical volumes of a size
1000MB?
2) create a logical volume cyber under cyberaegis with
a size of 400MB?
3) whenever users create files under /jijo those files
must be store under /dev/cyberaegis/cyber?
4) Append content of /lib into cyber logical volume?
5) Create another logical volume with a name of info
which should contain 500MB size?
6) copy entire content of /etc into /a which must be
store under /dev/cyberaegis/info?
7) Extend cyber lvm with a size of 100MB by reducing
100MB from info lvm (with out data loss)?
8) Extend volume group with 2 physical volumes of
400MB ?
9) Resize volume group cyberaegis with 150MB?
10) Remove cyberaegis volume group & all lvm enable
partitions?



         Redundant Array of Independent Disks (RAID)


      The basic idea behind RAID is to combine
multiple small,
      inexpensive disk drives into an array to
accomplish performance
      or redundancy goals not attainable with one
large and expensive
      drive. This array of drives appears to the
computer as a single
      logical storage unit or drive.
I.4.1. What is RAID?


      RAID allows information to access several disks.
RAID uses
      techniques such as disk striping (RAID
      Level 0), disk mirroring (RAID Level 1),
      and disk striping with parity (RAID Level
      5) to achieve redundancy, lower latency,
increased bandwidth,
      and maximized ability to recover from hard disk
crashes.



      RAID consistently distributes data across each
drive in the
      array. RAID then breaks down the data into
consistently-sized
      chunks (commonly 32K or 64k, although other
values are
      acceptable). Each chunk is then written to a
hard drive in the
      RAID array according to the RAID level employed.
When the data
      is read, the process is reversed, giving the
illusion that the
      multiple drives in the array are actually one
large drive.

I.4.2. Who Should Use RAID?


      System Administrators and others who manage
large amounts of
      data would benefit from using RAID technology.
Primary reasons
      to deploy RAID include:
    *



          Enhances speed


    *


           Increases storage capacity using a single
virtual disk


    *


          Minimizes disk failure



I.4.3. Hardware RAID versus Software RAID


      There are two possible RAID approaches: Hardware
RAID and
      Software RAID.

I.4.3.1. Hardware RAID


    The hardware-based array manages the RAID
subsystem
    independently from the host. It presents a single
disk per
    RAID array to the host.
     A Hardware RAID device connects to the SCSI
controller and
     presents the RAID arrays as a single SCSI drive.
An external
     RAID system moves all RAID handling "intelligence"
into a
     controller located in the external disk subsystem.
The whole
     subsystem is connected to the host via a normal
SCSI
     controller and appears to the host as a single
disk.



     RAID controller cards function like a SCSI
controller to the
     operating system, and handle all the actual drive
     communications. The user plugs the drives into the
RAID
     controller (just like a normal SCSI controller)
and then adds
     them to the RAID controllers configuration, and
the operating
     system won't know the difference.

I.4.3.2. Software RAID


    Software RAID implements the various RAID levels
in the kernel
    disk (block device) code. It offers the cheapest
possible
    solution, as expensive disk controller cards or
hot-swap
    chassis 1 are not required. Software RAID also
works with
    cheaper IDE disks as well as SCSI disks. With
today's faster
    CPUs, Software RAID outperforms Hardware RAID.
    The Linux kernel contains an MD driver that allows
the RAID
    solution to be completely hardware independent.
The
    performance of a software-based array depends on
the server
    CPU performance and load.



    To learn more about Software RAID, here are the
key features:


    *



            Threaded rebuild process


    *


            Kernel-based configuration


    *


             Portability of arrays between Linux
machines without
             reconstruction


    *
              Backgrounded array reconstruction using
idle system
              resources


    *


              Hot-swappable drive support


    *


             Automatic CPU detection to take advantage
of certain CPU
             optimizations



I.4.4. RAID Levels and Linear Support


      RAID supports various configurations, including
levels 0, 1, 4,
      5, and linear. These RAID types are defined as
follows:


    *



           Level 0 — RAID level 0, often
           called "striping," is a performance-oriented
striped data
           mapping technique. This means the data being
written to the
             array is broken down into strips and written
across the
           member disks of the array, allowing high I/O
performance at
           low inherent cost but provides no
redundancy. The storage
           capacity of a level 0 array is equal to the
total capacity
           of the member disks in a Hardware RAID or
the total capacity
           of member partitions in a Software RAID.


    *


           Level 1 — RAID level 1, or
           "mirroring," has been used longer than any
other form of
           RAID. Level 1 provides redundancy by writing
identical data
           to each member disk of the array, leaving a
"mirrored" copy
           on each disk. Mirroring remains popular due
to its
           simplicity and high level of data
availability. Level 1
           operates with two or more disks that may use
parallel access
           for high data-transfer rates when reading
but more commonly
           operate independently to provide high I/O
transaction
           rates. Level 1 provides very good data
reliability and
           improves performance for read-intensive
applications but at
           a relatively high cost. 2 The storage
capacity of the level 1 array is
           equal to the capacity of one of the mirrored
hard disks in a
           Hardware RAID or one of the mirrored
partitions in a
           Software RAID.


    *


          Level 4 — Level 4 uses parity
          3 concentrated on a single disk drive to
protect
             data. It is better suited to transaction
I/O rather than
             large file transfers. Because the
dedicated parity disk
             represents an inherent bottleneck, level 4
is seldom used
             without accompanying technologies such as
write-back
             caching. Although RAID level 4 is an
option in some RAID
             partitioning schemes, it is not an option
allowed in Red
             Hat Enterprise Linux RAID installations. 4
The storage capacity of Hardware RAID level 4
             is equal to the capacity of member disks,
minus the
             capacity of one member disk. The storage
capacity of
             Software RAID level 4 is equal to the
capacity of the
             member partitions, minus the size of one
of the partitions
             if they are of equal size.


    *
           Level 5 — This is the most common
           type of RAID. By distributing parity across
some or all of
           an array's member disk drives, RAID level 5
eliminates the
           write bottleneck inherent in level 4. The
only performance
           bottleneck is the parity calculation
process. With modern
           CPUs and Software RAID, that usually is not
a very big
           problem. As with level 4, the result is
asymmetrical
           performance, with reads substantially
outperforming
           writes. Level 5 is often used with write-
back caching to
           reduce the asymmetry. The storage capacity
of Hardware RAID
           level 5 is equal to the capacity of member
disks, minus the
           capacity of one member disk. The storage
capacity of
           Software RAID level 5 is equal to the
capacity of the member
           partitions, minus the size of one of the
partitions if they
           are of equal size.


    *




    RAID 0 (striping without parity)
    RAID 1 (disk mirroring)
    RAID 4 (parity)
    RAID 5 (disk stripping with parity)



RAID0:

minimum-2 harddisks
Maximum-32 harddisks
  Details written alternately and evenly into two or
more disks
read & write speed is fast
fault tolerance not available




RAID1:


minimum-2 harddisks
maximum-2 harddisks

Simaltaneously data will be written to two volumes on
two different disks
read speed is fast & write is slow
fault tolerance available
50% overhead



RAID4:

minimum-3 harddisks
maximum-32 harddisks

Data is written alternately and evenly to two or more
disks and a parity is also written on one disk
Read & write speed is fast
fault tolerance is available
RAID5:


minimum-3 harddisks
maximum-32 harddisks
Data is written alternately and evenly to two disks
and a parity is written in all disks
read & write speed is fast

fault tolerance is available
also known as striped with parity


steps to create a raid
create multiple partitions
# fdisk /dev/sda
n
+200M
t
fd
# partprobe


to club raid partitions into a single array

#mdadm -C /dev/md0 -n3 /dev/sda{9,10,11} -l5


to display raid device
#mdadm -D /dev/md0

to format

#mke2fs -j /dev/md0

create a mount point
#mkdir /raid

to mount the raid device

mount /dev/md0 /raid
cd /raid

to make a partition faulty

#mdadm -f /dev/md0 /dev/sda10


to remove a faulty partition from array

#mdadm -r /dev/md0 /dev/sda10


to add a new partition into raid array

#mdadm -a /dev/md0 /dev/sda11

to watch data recovery


#cat /proc/mdstat


to stop raid, but before stopping you should unmount

#mdadm -S /dev/md0

to Activate raid


#mdadm -A /dev/md0 /dev/sda{9,10,11}

                       BACKUP&RECOVERY

USERS OF BACKUP&RECOVERY:
    1)To copy data to alternate media
    2)To prevent data loss
Only administrators can backup the data

Types of data:
1)System generated data
2)User generated data

Types of backup:
1)Full backup
2)Incremental backup
3)Differential backup

1)Full backup:complete backup of entire system

2)Incremental backup:it includes all files that were
changed since last backup. It always smaller than
differential backup.

3)Differential backup:it includes all the files that
were changed since last full backup. As time increases
since the last full backup the size of differential
backup increases.

Commands for backup:
1)tar(tape archieve)
2)cpio(copy input/output)
3)dump

1)tar:
#tar <options> <destination> <source>
Note:destination must be in .tar extension
options:
-c=create
-v=verbose
-f=file
-t=table of content
-x=extract to
-w=interactive
-z=zip
To take backup
#tar -cvf <path> <file name> <source>
ex:tar -cvf passwd.tar /etc/passwd

To list the content of tar file
#tar -tvf <path> <file name>
ex:tar -tvf passwd.tar

To extract content of file
#tar -xvf <path> <file name>
ex:tar -xvf passwd.tar

To take backup along with zip
#tar -cvzf <path> <file name>
Note:file name must be with an extension of .tar.gz
ex:tar -cvzf passwd.tar.gz /etc/passwd

To extract zip file
#tar -xvzf <path> <file name>
ex:tar -xvzf passwd.tar.gz

Backup using cpio:
#ls <options> | cpio -ov > <file name>
ex:ls -l | cpio -ov > sun

To extract:
#cpio -iv <file name>
ex:cpio -iv sun

Backup using dump:
#dump -0uf <device> <file name>
ex:dump -0uf /media/<pendrive> sun
To extract:
#restore -f <path>
ex:restore -f sun

Remote backup:
#rsync -avz <source> -e ssh <destination
IP>:<directory>
ex:rsync -avz sun -e ssh 192.168.0.1:/root/sun

#scp -r <source> <destination IP>:<directory>
ex:scp -r sun 192.168.0.1:/root/sun




                 PROCSTAT

#DESCRIPTION
ps displays information about a selection of the
active processes. If you want a repetitive update of
the selection and the displayed
information, use top(1) instead.

This version of ps accepts several kinds of options:
1   UNIX options, which may be grouped and must be
preceded by a dash.
2   BSD options, which may be grouped and must not be
used with a dash.
3   GNU long options, which are preceded by two
dashes.

Options of different types may be freely mixed, but
conflicts can appear. There are some synonymous
options, which are functionally
identical, due to the many standards and ps
implementations that this ps is compatible with.

Note that "ps -aux" is distinct from "ps aux". The
POSIX and UNIX standards require that "ps -aux" print
all processes owned by a user named
"x", as well as printing all processes that would be
selected by the -a option. If the user named "x" does
not exist, this ps may interpret
the command as "ps aux" instead and print a warning.
This behavior is intended to aid in transitioning old
scripts and habits. It is fragile,
subject to change, and thus should not be relied upon.

By default, ps selects all processes with the same
effective user ID (euid=EUID) as the current user and
associated with the same terminal as
the invoker. It displays the process ID (pid=PID), the
terminal associated with the process (tname=TTY), the
cumulated CPU time in
[dd-]hh:mm:ss format (time=TIME), and the executable
name (ucmd=CMD). Output is unsorted by default.

The use of BSD-style options will add process state
(stat=STAT) to the default display and show the
command args (args=COMMAND) instead of
the executable name. You can override this with the
PS_FORMAT environment variable. The use of BSD-style
options will also change the process
selection to include processes on other terminals
(TTYs) that are owned by you; alternately, this may be
described as setting the selection
to be the set of all processes filtered to exclude
processes owned by other users or not on a terminal.
These effects are not considered when
options are described as being "identical" below, so -
M will be considered identical to Z and so on.

Except as described below, process selection options
are additive. The default selection is discarded, and
then the selected processes are
added to the set of processes to be displayed. A
process will thus be shown if it meets any of the
given selection criteria.

EXAMPLES
To see every process on the system using standard
syntax:
   ps -e
   ps -ef
   ps -eF
   ps -ely
To see every process on the system using BSD syntax:
   ps ax
   ps axu

To print a process tree:
   ps -ejH
   ps axjf

To get info about threads:
   ps -eLf


To terminate a process:
#kill <process ID>
ex: kill 3429
If the process wont killed you have to kill parent ID


To kill parent ID:
#kill -9 <parent ID>
ex:kill -9 1

To view entire network process:
#top


                 RPM(REDHAT PACKAGE MANAGER)

    Rpm is the acronym for redhat package manager
By using rpm utility the user can instal new packages
or upgrade and can also remove existing packages.
Pattern:
xmms 1.2.10-9.i386.rpm
here xmms is the name of package & 1.2.10-9 is the
version of package & i386 is the type of architecture
of the package & .rpm is the extension.

To install rpm:
#rpm <options> <package> --force --aid
options:
-i = install
-v = verbose
-h = to display progress in hashes
--force = to install forcefully
--8 = to install packages with dependencies

ex:rpm -ivh nfs-* --force --aid

To upgrade:
#rpm <options> <packages>
options:
-U = upgrade
-v = verbose
-h = to display in hashes

ex:rpm -Uvh nfs

To remove an rpm:
#rpm <options> <package> --nodeps
options:
-e = to install package from the system

ex:#rpm -e nfs --nodeps

To query rpm package:
#rpm <options> <package>
options:
-q = to query the availability of installed package
-qa = queries all installed rpm's in o/s
-qc = list only configuration files stored in queried
rpm
-qd = list only doc files stored in queried rpm
-qi = displays complete information about queried rpm
-qs = displays status of files in queried rpm
-ql = displays files related to queried rpm



to get rpm's from server:
#mount 192.168.0.254:/var/ftp/pub /mnt
#cd /mnt

#cd Server
#rpm -ivh <package> --force --aid


to get rpm's from cd
place rhel5 dvd in cd-rom
#mount /dev/cdrom /mnt
#cd /mnt
#cd Server
#rpm -ivh <package> --force --aid

                 YUM(YELLOW DOG UPDATE MODIFIER)

    Yum is an interactive automated update programme
which can be used for maintaining systems using rpm.

    We have to create a private repository from server
to access rpm's by this yum. We can save bandwidth by
using this yum.

To create private repo file:
#cd /etc/yum.repos.d
#vi <file name>
Note:file name must be with an extension of .repo
[server] (repbox name)
 name= (type any name)
 baseurl=ftp:<serverip> <shareddirectory>
  gpgcheck =0

ex:
[redhat]
 name= my repo box
 baseurl=ftp://server1.redhat.com/pub/Server
 gpgcheck=0

(save&quit)
To clean repobox
#yum clean all

To update packages from server:
#yum update

To install a package:
#yum install <package> -y
ex: yum install nfs-* -y

To remove a package:
#yum erase <package>

To update a package:
#yum update <package>

To list all packages:
#yum list

To know package usage:
#yum what provides <package>
ex:yum what provides nfs




                   VNCVIEWER

    Vncviewer is used to share the desktop as a
network resource to client.

    The remote desktop preference tool enables you to
share a desktop session between multiple users, and to
set session-sharing preferences.
RDP is the protocol works for this vnc viewer (Remote
Desktop Protocol)

To install vncviewer:
#yum install vnc-* -y
click on system--preferences
select remote desktop
check allow other users to view your desktop

If you want to give access permissions
select check ask your conformation
close

To create Authentication:
select require the user to enter this password
provide password
close




FROM CLIENT SIDE:

    In client pc also vnc package must be install
#yum install vnc-* -y
goto applications--accessories--vncviewer
type server address :0
ok



In SERVER SIDE:

    If you want to allow user to control your desktop
system--preferences--remote desktop
select allow others to control your desktop




text level accessing:
#ssh <system ip>


SWITCHING GNOME/KDE

    In linux we can work with number of desktops at a
time.

    While installation we will select only one
desktop. If we want to access another desktop(KDE). We
have to install that desktop package then we can use
both desktops at a time.

To install KDE:
Graphical mode:
Applications--add or remove software
select KDE
apply

Text mode:
#system-config-packages
select KDE--apply--continue--continue--ok--Alt+F4
(now KDE was install)

To check whether KDE is install or not
click on applications--accessories(if kmag, kgpg is
there then KDE was install)

To work with KDE:
goto system--preferences--more preferences--prefered
applications--system
select KDE
close


Printer Configuration


  Printer Configuration Tool allows users to
   configure a printer. This tool helps maintain the
printer
   configuration file, print spool directories, print
filters, and
   printer classes.



   Red Hat Enterprise Linux 5 uses the Common Unix
Printing System
   (CUPS). If a system was upgraded from a previous
   Red Hat Enterprise Linux version that used CUPS


To configure a network printer:
#system-config-printer
select new printer
type your system host name under printer
forward
select internet printing protocol
type your system host name under host name
type printer connected system host name under printer
name
forward
select type of printer
forward
select model of printer
forward
apply
click on your host name
select make default printer

To view current printing que:
#lpq

To give a file for print
#lpr <file name>
ex:lpr /etc/fstab

#lprm <filename>
                 REMOTE FILESHARING

    By using this remote filesharing we can send or
get files from remote systems.

    We have two methods for this
1)rsync
2)scp
rsync stands for remote synchronization
scp stands for secure copy
Behind this one ssh protocol will works
1)rsync:
syn: #rsync -avz <source file> <destination IP>:<path>
ex: #rsync -avz sun 192.168.0.1:/root
provide password

2)scp:
syn: #scp -rv <source file> <destination IP>:<path>
ex: #scp -rv sun 192.168.0.1:/root
provide password

                 AUTOMATIC JOBS


     As a system administrator some tasks are
respective like backup, monitoring, log files.
     To automate them with the help of
1)at
2)batch
3)crontab
Crontab:to run some tasks automatically
to set a crontab for an user
#crontab -e -u <user name>
* * * * * /bin/echo "hello"
A crontab file contains instructions to the cron
deamon of the general form
"run this command at this time on this date"
Cron examines entries once every minute

field                allowed values
-----
 --------------
minute                0-59
hour                   0-23
day of month      1-31
month                1-12 (or names, see below)
day of week       0-7 (0 or 7 is Sun, or use names)

       A field may be an asterisk (*), which always
stands for ‘‘first-last’’.

       Ranges of numbers are allowed. Ranges are
two numbers separated with a
       hyphen. The specified range is inclusive.
For example, 8-11 for an
       ‘‘hours’’ entry specifies execution at hours 8,
9, 10 and 11.

       Lists are allowed.     A list is a set of
numbers (or ranges) separated by
       commas. Examples: ‘‘1,2,5,9’’, ‘‘0-4,8-12’’.


EXAMPLE CRON FILE
       # use /bin/sh to run commands, no matter what
/etc/passwd says
       SHELL=/bin/sh
       # mail any output to ‘paul’, no matter whose
crontab this is
       MAILTO=paul
       #
       # run five minutes after midnight, every day
       5 0 * * *       $HOME/bin/daily.job >>
$HOME/tmp/out 2>&1
       # run at 2:15pm on the first of every month --
output mailed to paul
       15 14 1 * *     $HOME/bin/monthly
       # run at 10 pm on weekdays, annoy Joe
       0 22 * * 1-5   mail -s "It’s 10pm"
joe%Joe,%%Where are your kids?%
       23 0-23/2 * * * echo "run 23 minutes after
midn, 2am, 4am ..., everyday"
       5 4 * * sun     echo "run at 5 after 4 every
sunday"


To set a crontab for an user
#crontab -e -u <user name>
ex:crontab -e -u alex

To remove a crontab for an user
#crontab -r -u <user name>
ex:crontab -r -u alex

crontab -l -u sam - to see which command has been
assigned to sam

mesg

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:38
posted:7/31/2012
language:
pages:67