ALM-vol2

  • Upload
    mikel

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

  • 8/3/2019 ALM-vol2

    1/57 1

    Copyright 2003 Vegaslocal.com Publishing. All rights reserved. Printed in the UnitedStates of America, published by vegaslocal.com all other trademarks are properties oftheir respective owners.

    While every precaution has been taken in the preparation of this book, the publisher and theauthor assume no responsibility for errors or omissions.

  • 8/3/2019 ALM-vol2

    2/572

    Agustns Linux Manual

    System Administration

    Volume 2ISBN: 0-9752804-1-4

    Published by:Vegaslocal.com

  • 8/3/2019 ALM-vol2

    3/57 3

    About the author

    !""#$%

    #$#

    #$

    #& ##

    %$# % ' #$ #

    % ($# !% )

    % #$ # % #$ # $(&%*$%

    ' ! $

    # * +,-

    %*.###&-

    ###%*$/01

    The purpose of this series and why it was written %$ %## %$#

    #$##

    %#%#

    %$$%.#

    #%!2(3(% . # . (& %

    #

    Dedication4##$05.

    ###$%#.##$6

    % # %

    %.####$%%

    $%

    Acknowledgement. $ $ 7$ 8# # # 9:#%$%

    %%$7%$#%##

    #%$

  • 8/3/2019 ALM-vol2

    4/574

    Content

    Chapter 3Administration 6Welcome to system administration 6Terminals 7Xterms 7

    Shells 7Command aliases 7Command basics 8The root directory 9Executing commands as root 10File specs 11File permission chmod 12User IDS and Groups 13How permissions are assigned? 13Change ownership chown 14How can you change the group? 15Running multiple commands 15Multiple virtual terminals 15

    Killing processes 16Bash configuration files 17Changing the prompt 17Setting number to vi editor 18Creating path environment 19Writing and executing shell script 19The midnight commander 21Copying file with mc 22Mcs F commands 22File permission with mc 23Searching files with mc 23The Linuxconf utility 24Networking with linuxconf 25DNS client workstation 27Router and gateway 28Adding users from Linuxconf 29Enabling user accounts 30Disabling user accounts 30Parameters for user accounts 30Privileges for user accounts 31Account policies 31Managing groups 31Changing the root password 33Mounting file system 33Reviewing your current file system 34NFS Mounts 34Adding NFS Mounts 35

    Implementing disk quotas 36Effect of quotas on users 37Miscellaneous services 37The linuxconf control 38Controlling services 39Linuxconf module management 40

    Chapter 4Mandrake control center 41

  • 8/3/2019 ALM-vol2

    5/57 5

    Creating a boot disk 41Boot configuration 42Switching the boot mode text/graphical 43Creating a pre-installation disk 44Video resolution 44The graphical server configuration 45Printer configuration 45Installing printers in expert mode 47Samba windows printer 49Installing scanners 49Managing services 50Managing users 51Backups 52Software management 53Installing packages using command line 54Installing cups using the packager manager 55Uninstalling software 57Accessing cups 57

  • 8/3/2019 ALM-vol2

    6/576

    Chapter 3

    Administration # % 2 %#

    ##$%%$$##;#$#

    3$#$$

    %#%?#,(#*$

    $

    #

  • 8/3/2019 ALM-vol2

    7/57 7

    !$##$#%BC

    %>$C

    *$0 07%

    ($%

    #$##C?DE.$($##

    C$##.

    $%E2.>6:%

    TerminalsE2.>%#

    # 8% 9 $% E #%

    FF

    ##&%#+,#$%##

    F//FFF.

    #F;;F

    Xterms."/>4GH#.$4(!2(!>%FF>

    #FFFFFFF

    4I

    Shells

    8$9#;8.-9# # % E2.>

    89##%(F*# % ( F%F D2E

    Command aliases%%#.%#$

  • 8/3/2019 ALM-vol2

    8/578

    FF

    FF

    FF

    F

  • 8/3/2019 ALM-vol2

    9/57 9

    The root Directory[agustin@server2 agustin]$ ls /

    # % # %

    ;

    ;% %

    ;% %

    ;% %$

    ; ;;/;;

    ;

    ;% %%%$

    ; #

    ; #

    ; '#:#

    ; #%$(

    ; ##$

    ; %M

    ; '0!

  • 8/3/2019 ALM-vol2

    10/5710

    $!!!"" !

    [agustin@server2 agustin]$ who

    " % "%&'&()

    * "%+',-% % ( "%+',.,

    [agustin@server2 agustin]$

    /!"""0![agustin@server2 agustin]$ su

    !1111111 23

    [root@server2 agustin]# whoami

    [root@server2 agustin]#

    -% % 7 :%# 3

    Executing commands as root##7%#

    [root@server2 agustin]# cd /home/user1

    "

    [root@server2 user1]# mkdir collections

    "

    [root@server2 user1]#cd collections

    [root@server2 collections]#

    (####$ C %

    [root@server2 collections]#echo paste this information to a file > myfile

    (#$#%

    [root@server2 collections]#cat myfile

    paste this information to a file

  • 8/3/2019 ALM-vol2

    11/57 11

    [root@server2 collections]#

    [root@server2 collections]# mkdir onother

    [root@server2 collections]#ls

    O ;

    [root@server2 collections]#

    7$%$:#4#%$#

    [root@server2 collections]#cp myfile original.myfile

    [root@server2 collections]#

    !!#!4!

    [root@server2 collections]#ls l

  • 8/3/2019 ALM-vol2

    12/5712

    ! #

    C % %

    " - # # # % :

    %

    #[user1@server2 collections]$cp file2 file3

    cp: can not create regular file file3: Permission denied

    [user1@server2 collections]$

    2##

    %#

    "[user1@server2 collections]$ rm afile

    rm: remove write-protected regular file afile? y

    rm: can not remove afile: Permission denied

    [user1@server2 collections]$

    (#$7 # %

    %-%%

    2##

    File permission with chmodchmod

    SyntaxChmod [permissions] filenames

    /!"""

    7 7!""

    7#N8.9

    "

    8 9U User who owns the file 400 Read by ownerg group that owns the file 040 Read by group

  • 8/3/2019 ALM-vol2

    13/57 13

    o Other 004 Read by othersa All 200 Write by ownerr Readable file 020 Write by group

    w Writeable file 002 Write by othersx Executable file 100 Execute by owner

    010 Execute by group001 Execute by others

    %IO

    # % #

    4#$#####%

    User IDS and Group IDS UID/GIDEE2.> %%#

    # % # % $%5#

    6.!

    .!%

    .!%

    N

    .!%

    .!%

    How permissions are assigned?%N

    /

  • 8/3/2019 ALM-vol2

    14/5714

    ##%C%%

  • 8/3/2019 ALM-vol2

    15/57 15

    ###%%

    How can you change the group?$#

    .#"%

    root@server2 collections]#chown user1.user1 afile

    9!$!5[root@server2 collections]#ls l

    # $ 7% " 7 # $

  • 8/3/2019 ALM-vol2

    16/5716

    .%$

    $%>?7&

    % "#

    '#%$

    #$

    (#?:

    [user1@server2 user1]$Command &

    #6%%%$6%

    [user1@server2 user1]$ jobs

    [1]+ Running application &

    @A

    Killing Processes(6%%% % % . $%6

    [root@server2 agustin]# ps aux

    #

    4IO

    .(3.!%3.!%

    #!"

  • 8/3/2019 ALM-vol2

    17/57 17

    [root@server2 Agustin]# kill 2644 (This command would kill linuxconf, fig

    3.2)

    $#

  • 8/3/2019 ALM-vol2

    18/5718

    21 ;;

    22 esac

    23 # [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

    24

    25 [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="\[\e[1;32m\] \w\\$\[\e[1;37m\]"

    26

    27 if [ -z "$loginsh" ]; then # We're not a login shell

    28 for i in /etc/profile.d/*.sh; do

    29 if [ -x $i ]; then30 . $i

    31 fi

    32 done

    33 fi

    34 fi

    35

    36 unset loginsh

    0OIO

    3

  • 8/3/2019 ALM-vol2

    19/57 19

    Creating path environmentD#$$%.#7#%

    $% /etc.

    4E%#%

  • 8/3/2019 ALM-vol2

    20/5720

    #! /bin/bash

    echo \Hello I am a little program\

    echo I am in the directory:

    echo

    pwd

    echo

    echo do an ls l

    ls l

    echoecho

    "#

  • 8/3/2019 ALM-vol2

    21/57 21

    5

    .6!L6%% %%.%"%+''-([user1@server2 myscript]$

    ( $ %

    $#.%$

    The midnight commander#$:##

    %

    ..###3%%#%#

    .%

    823

    [user1@server2 user1]$su

    Password:***********[root@server2 user1]#mc

    4IO

    %:%.%#%

    -% . # " C %#%%$

    ##

    Copying File with mc 89$C#

  • 8/3/2019 ALM-vol2

    22/5722

    *$$##(8#

    9(7

    4

    4II

    .%6M@

    $!"!#!NEO

    MCs F commands%IO:

    %:44/

    Fig. 3.4

    *4

  • 8/3/2019 ALM-vol2

    23/57 23

    File permission with mc#

    4IH

    . # (JIH

    --% % %

    89

    Searching files with mc4% U 7(-51

    4IA

  • 8/3/2019 ALM-vol2

    24/5724

    4IG

    $4IG:##89C#

    *##

    #C.$#% .P

    The Linuxconf Utility.O#%.#

    7%.%$%#

    %#

    8 #$9.# %

    %#

    2N/%

    (>N[agustin@server2 agustin]$startx

    M"

    4I" 4I/

  • 8/3/2019 ALM-vol2

    25/57 25

    7$ # % # # 0## .%

    $)#P%N"##

    C # %

    !%$5##

    ##

    K/!

    ..##$$.

    % %$#% ($#OA.

    Networking with linuxconfStatic IP Address Configuration

    -"JV9!"JVJVJ$!

    .#

    (#$.#.3.##%%

    4I

    $N3.3%

    .

    $N 3 .3 %

    # #$

    #$#%:0

    (

    % . # 4.

    D% $##

    .(3 %# .

    M N0$J $!N

  • 8/3/2019 ALM-vol2

    26/5726

    4IO

  • 8/3/2019 ALM-vol2

    27/57 27

    6/!2%;'36

  • 8/3/2019 ALM-vol2

    28/5728

    Router and Gateway!2(&!2($#

    $# "! 7 # # % %

    $%8OA//9#

    $#

    4I

    ##?(%

    4IH

    1#.3%$%

    0$

    0$!

    0$!

    0$W

    - IA # % .8O92.3%

    %#%

  • 8/3/2019 ALM-vol2

    29/57 29

    4IA

    0$!

    -$C#%%##$8/??-590#$

    Adding users from Linuxconf-"JVGJV9JVG.#

    #

    4IG#$E

    0$

    1"

    1 1""#%

    ( "#%%

    4I"

  • 8/3/2019 ALM-vol2

    30/5730

    C

    $

    4IO/

    -"JVGJV9JVG

    ( (

  • 8/3/2019 ALM-vol2

    31/57 31

    Q"R%$F#

    % . $#;##R%

    . # %

    R1

    Privileges for User Accounts. " # ;

    .#%%$##.#

    %# S S# "> # $ F # % # $

    3"#

    *:%#)%

    #$$

    Q>N#F%

    Q !N D # % % # 2#.#%$4

    %-$89%

    Account policiesGJVJV!?

    #:#%

    C & # D #

    %%#%

    #%F#!F###

    ##:#$- N

    +,

    Managing groupsUsers => Normal => Group Definitions

    %-$#

    $.%##///#///0B

    ($6%($ $# ' :##$%

    B ( #

  • 8/3/2019 ALM-vol2

    32/5732

    4N

    *$

    1

    '

    4IO

    1###-##

    0$

    4IOI

    1

    .!

    %$

    .$#

    -$#%4##%%

    ##

  • 8/3/2019 ALM-vol2

    33/57 33

    Changing the Root Password4##&

    -"JVGJV9JV"!

    $##%##

    E#-###

    #N

    [root@server1 root]# passwd username

    Mounting file system

    4IOP##$#%

    4$0!

  • 8/3/2019 ALM-vol2

    34/5734

    %%#

    Reviewing Your Current File system

    -"JV7JV

    "(*(.!1

    $ .!1

    4IO

    ..!1#%% #%?#%%

    QN#

    7NO

    $"/I!-(4H7#4H4IO7#224(

    /:N3(

    N

    /N7

    NFS Mounts.24(#%#$

    "JV7JV

  • 8/3/2019 ALM-vol2

    35/57 35

    4IOH

    7#$4#$:%

    #%#%

    4N/var/spool/mail#

    /var/spool/mail %

    7Q##%YY

    Adding NFS Mounts#N

    -97/

    4IOA

    /N#

    4

    TN#4/usr/engineering

    /designs

    QN##%%4;;

  • 8/3/2019 ALM-vol2

    36/5736

    -

    9N

    #24( #% 97/ # %

    >#/etc/fstab3

    T

    Implementing disk quotasW%!$&%

    $ # %

    !$$

    !$&%%

    .$#.%?#&

    9- 1-

    (&%#&:#& " & %&%

    7JVJV/ JVMJVGA

    &%%%

    4IOG

    .&%#.

    &*%%

  • 8/3/2019 ALM-vol2

    37/57 37

    4IO"

    /N%E %

  • 8/3/2019 ALM-vol2

    38/5738

    Run levels

    4II/

    %

    !89%#I

    .##

    Kernel configuration

    .$##

    System logs'#

    Peripherals

    ##..(&$.

    )O

    C C #

    The Linuxconf Control:%%#%$%

    # % ##

  • 8/3/2019 ALM-vol2

    39/57 39

    4IIO

    "

    #/!##.

    Controlling services%%&*%$0#%#

    (

    JVJV ;U

    4III

    $.8!2(9

  • 8/3/2019 ALM-vol2

    40/5740

    # % # % (

    !.%$%%

    7.&.#

    # 8 ?9

    2 ( !

    1

    Linuxconf Module management..

    4IIP

    '#

    1##%%

    .###%##

    #B

    #:#

    ##..##

    2.#:

    $ % %% #

    0$089;

  • 8/3/2019 ALM-vol2

    41/57 41

    Chapter 4

    Mandrake control center*$ 0 0 Q > .%

    %%'#

    &%#

    *$ % $#DrakConfmcc

    [user1@server2 user1]$mcc

    Or[user1@server2 user1]$drakconf

    .O##

    .## % $

    4P

    .$%%#

    .OZI#.

    Creating a Boot Disk!%$.%$$#

    $

  • 8/3/2019 ALM-vol2

    42/5742

    4PO

    $ % $

    %% 7 %#$$#.$-5

    8 M@

    7###%

    Your Boot-Up Configuration

    #;D%%C

    # % $$# displays your current

    boot loader. 4PI##%

    .#%.

    4PI

  • 8/3/2019 ALM-vol2

    43/57 43

    .$0%%C#%###.

    4PP

    # # % # % #%

    ##%

    #%.

    $#%$#%)%#$

    % $

    89/tmp%

    Switching boot mode Text/Graphical!.%%

    %$% . % # # ;

    1 . 6 # #

    # % $B $

    $6"C%%+$,%#9M&

    #9

    9

    *$ 6"### 4

    !##

    - /etc/inittab, %

    7

    id:5:initdefault: Number 5 in this line

    means to boot into

    graphical mode

    (observe above this line

    you have a menu of

    booting modes 0-6)

  • 8/3/2019 ALM-vol2

    44/5744

    #% 7!#-#(

    # $6startx

    *$8!9##

  • 8/3/2019 ALM-vol2

    45/57 45

    [root@server2 root]#XFdrake

    0 E7##

    #:

    >4$$#%#.## %#R %B7%B

    .2.!..#$#$#% 7 $ %

    The graphical server configuration.$

    # .

    #

    . % $ %(>##

    2N 3 !

    Printer configuration

    .#%

    .%#$NLPRng-3.8.12-2mdk

    !!!

    4PH

  • 8/3/2019 ALM-vol2

    46/5746

    0$#%0!$

    &$-5

    2N3!"!##$%

    $N

    4PA

    .

    0$#

    C#

    # (

    4PG

    0$-5

    ##%

    *$M

    4P"

    1#

  • 8/3/2019 ALM-vol2

    47/57 47

    Fig. 4.10

    0$$

    3$#%

    #

    4P

    7$#M ($

    # % # # B

    .#!

    .#

    (

    -$ 0 !

    C%#.#$%#.

    Installing printers in Expert Mode.0E3(#%#N

    4PO

    "N .3

    %

  • 8/3/2019 ALM-vol2

    48/5748

    E((

    %#%

    4PP

    %

    1

    9!23 #$

    .3

    Fig. 4.15

    1.3-U!%"//

  • 8/3/2019 ALM-vol2

    49/57 49

    Samba windows Printer

    /Q8! +-+)9 N 3

    ## (3 : 1! # %

    4PH

  • 8/3/2019 ALM-vol2

    50/5750

    ($-5

    C# " E 8 > % (21 8( 2# 19 %9 $

    $ ( $ %

    Managing servicesC#%

    $%

    Services

    0 : ) 4 %#/

    (%%8Z9%

    ##

    %$-$#%##

    4PG

    .%C#

    2N

    4The Font

    #?

  • 8/3/2019 ALM-vol2

    51/57 51

    Date and time

    6

    The logs

    C

    The console

    8E

  • 8/3/2019 ALM-vol2

    52/5752

    $C#89

    4PO/

    2N3!

    Program scheduler

    % %% #

    (##%% 0$$

    E$$#

    %

    0$-5

    0$

    0$#%&

    To remove a scheduled task

    ($!

    Backups

    #%$

    :"

    "

    8!

    !:"ND#

    %$$

    %$

    8" (%$$

    (%$

  • 8/3/2019 ALM-vol2

    53/57 53

    0$

    4PO

    0# 7$-5

    C%$

    4POO

    0$

    0$ $#

    0$%%$

    C$?

    Software management

    .$####.

    6%%% $

    $##:#$ % 4 8$9

    %$ $D)3*53$#% #

  • 8/3/2019 ALM-vol2

    54/5754

    )3*N"

    [

  • 8/3/2019 ALM-vol2

    55/57 55

    --nodeps E##

    --allfiles .$

    Querying

    root&N

    .&6"F

  • 8/3/2019 ALM-vol2

    56/5756

    Fig. 4.23

    CN

    /

    >

    ""

    0$% -$$

    2N 7 -

    5

    0$

    10!0$-5

    C#%#:#$#

    4POP

  • 8/3/2019 ALM-vol2

    57/57

    6 .

    $:$