configuring and administering linux

Upload: francisemmanuelgonzaga

Post on 24-Feb-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 Configuring and Administering Linux

    1/4

    Confguring and Administering Linux

    Contents:User and Group AdministrationFilesystem AdministrationStarting and Stopping the System and Services

    Viewing System essages and LogsSetting the System !ime and !ime "one

    !his chapter e#uips you to per$orm common system administration tas%s& 'y using a $ewsimple commands and a text editor( you can override many confguration choices madeduring system installation& )ou*ll learn how to add( delete( and modi$y user accounts( and howto add and delete groups and change their mem+ership& )ou*ll learn how to confgure swapspace and how to cause Linux to automatically mount flesystems& !his chapter doesn*t dealwith the confguration and administration o$ networ% $acilities( such as servers& !hose topicsare covered in Chapters ,-( ,,( and ,.&

    /&, User and Group Administration

    0n this section( you*ll learn how to per$orm common administrative tas%s a1ecting users andgroups& ost system administration tas%s re#uire that you login as root& !hroughout thissection and su+se#uent section( you should assume that you must +e logged in as root(unless directed otherwise&

    /&,&, Creating a User Account

    !o create a user account( you use the adduser command( which has the $orm:

    adduser

    userid

    where useridspecifes the name o$ the user account that you want to create& !he commandprompts you $or the in$ormation needed to create the account&

    2ere*s a typical example o$ using the command( which creates a user accountnamed myman:

    useradd 3m 3s 4home4myman myman

    /&,&. Changing a User*s 5ame

    )ou can change the name associated with a user account( +y using the ch$n command:

    ch$n 3$name userid

    where namespecifes the new name and useridspecifes the account to +e modifed& 0$ thename contains spaces or other special characters( it should +e enclosed in dou+le #uotes 678&

    http://oreilly.com/openbook/debian/book/ch07_01.html#DCH07-PGFID-75140http://oreilly.com/openbook/debian/book/ch07_02.htmlhttp://oreilly.com/openbook/debian/book/ch07_03.htmlhttp://oreilly.com/openbook/debian/book/ch07_04.htmlhttp://oreilly.com/openbook/debian/book/ch07_05.htmlhttp://oreilly.com/openbook/debian/book/ch07_01.html#DCH07-PGFID-75140http://oreilly.com/openbook/debian/book/ch07_02.htmlhttp://oreilly.com/openbook/debian/book/ch07_03.htmlhttp://oreilly.com/openbook/debian/book/ch07_04.htmlhttp://oreilly.com/openbook/debian/book/ch07_05.html
  • 7/25/2019 Configuring and Administering Linux

    2/4

    For example( to change the name associated with the account new+ie to 9ew+ie 5ew+ie( youwould enter the $ollowing command:

    ch$n 3$ 79ew+ie 5ew+ie7 new+ie

    /&,& Changing a User Account ;assword

    From time to time( you should change your password( ma%ing it more di

  • 7/25/2019 Configuring and Administering Linux

    3/4

    groupdelgroup

    where groupspecifes the name o$ the group to +e deleted& For example( to delete the groupnamed new+ies( you would enter the $ollowing command:

    groupdel new+ies

    /&,&>& Adding a mem+er to a group

    !o add a mem+er to a group( you use a special $orm o$ the adduser command:

    adduseruser group

    where userspecifes the mem+er and groupspecifes the group to which the mem+er isadded& For example( to add the user new+ie-, to the group new+ies( you would enter the

    $ollowing command:

    adduser new+ie-, new+ies

    /&,&>&> ?emoving a mem+er $rom a group

    Un$ortunately( no command removes a user $rom a specifed group& !he easiest way toremove a mem+er $rom a group is +y editing the/etc/groupfle& 2ere*s an excerpt $rom atypical/etc/groupfle:

    users:x:,--:nogroup:x:@>:

    +mccarty:x:,---:new+ies:x:,--.:new+ie-,(new+ie-.(new+ie-

    Bach line in the fle descri+es a single group and has the same $orm as other lines( consistingo$ a series o$ felds separated +y colons 6:8& !he felds are:

    Group name

    !he name o$ the group&

    ;assword

    !he encrypted password associated with the group& !his feld is not generally used(containing anxinstead&

    Group 09

    !he uni#ue numeric 09 associated with the group&

  • 7/25/2019 Configuring and Administering Linux

    4/4

    em+er list

    A list o$ user accounts( with a comma 6(8 separating each user account $rom the next&

    !o remove a mem+er $rom a group( frst create a +ac%up copy o$ the/etc/groupfle:

    cp 4etc4group 4etc4group&SAVB

    !he +ac%up can prove help$ul i$ you modi$y the fle incorrectly& 5ext( open the/etc/groupflein a text editor& Locate the line that descri+es the group and delete the user name and the$ollowing comma( i$ any& Save the fle( exit the editor( and chec% your wor%&

    /&,& 9eleting a User Account

    !o delete a user account( use the userdel command:

    userdel

    user

    where userspecifes the account to +e deleted& 0$ you want to delete the user*s homedirectory( its fles and su+directories( use this $orm o$ the command:

    userdel 3ruser

    A?505G: 'ecause deleted fles can*t generally +e recovered( you should +ac%up potentiallyuse$ul fles +e$ore deleting a user account&