+ All Categories

sysadm

Date post: 14-Apr-2018
Category:
Upload: subhrajitm47
View: 216 times
Download: 0 times
Share this document with a friend

of 12

Transcript
  • 7/30/2019 sysadm

    1/12

    System Administration

    Learning Objectives:

    1. To understand the procedure of using externalstorage medium in Unix System

    2. To learn the method of retrieving hardwares

    information in Unix System

    3. To understand the method of setting up /managing users account in Unix System

  • 7/30/2019 sysadm

    2/12

    COMP111

    Lecture A2 / Slide 2

    System Administration

    Table of Content

    Using Floppies / CD-Rom (Sun)

    Using Floppies / CD-Rom (Linux)

    Disks

    User Accounts

    User Groups

    Shutdown

  • 7/30/2019 sysadm

    3/12

    COMP111

    Lecture A2 / Slide 3

    Using floppies/CDROM (Sun)

    Preparing PC format diskette in a Sun computer$ fdformat -v -U -b myfiles

    Formatting 1.44 M in /vol/dev/rdiskette0/unformatted

    Press return to start formatting floppy. [ Return ]

    -v Verifies whether the diskette was formatted correctly.

    -U Unmounts the diskette if it is mounted.

    -e Ejects the diskette when done formatting.

    -b label Name for the diskette. (

  • 7/30/2019 sysadm

    4/12

    COMP111

    Lecture A2 / Slide 4

    Using floppies (Linux)

    Default mount options of file systems stored in /etc/fstab$ cat /etc/fstab

    LABEL=/ / ext2 defaults 1 1

    LABEL=/data /data ext2 defaults 1 2

    /dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0

    /dev/fd0 /mnt/floppy auto noauto,owner 0 0none /proc proc defaults 0 0

    none /dev/pts devpts gid=5,mode=620 0 0

    /dev/hda5 swap swap defaults 0 0

    Mounting and dismounting a diskette (Linux)

    $ mount /dev/fd0

    mount: block device /dev/fd0 is write-protected, mounting read-only

    $ ls /mnt/floppy

    install.bat readme.txt utility

    $ umount /dev/fd0umount removable device before

    taking them out to flush all data

    If a diskette is write protected

    Device file name, mount point, file system type, mount options, dump opt, mount order

  • 7/30/2019 sysadm

    5/12

    COMP111

    Lecture A2 / Slide 5

    Using CDROM (Linux)

    Usually CDROMs are in standard ISO9660 format and

    therefore readable in all computer systems (but

    probably not for floppies and hard disks file systems)

    $ mount /dev/cdrom

    $ ls /mnt/cdrom

    95OR98.EXE INSTALLG.DOC README.TXT SETUP.FR VERSION.TXT

    $ eject

  • 7/30/2019 sysadm

    6/12

    COMP111

    Lecture A2 / Slide 6

    Disks Usage Statistics

    df display free blocks and # of files in each file system$ df | head

    /proc (/proc ): 0 blocks 934 files

    / (/dev/dsk/c0t3d0s0 ): 226544 blocks 280996 files

    /dev/fd fd ): 0 blocks 0 files

    /var (/dev/dsk/c0t3d0s3 ): 1480320 blocks 252851 files/cache (/dev/dsk/c0t3d0s4 ): 308472 blocks 243243 files

    /home (/dev/dsk/c0t3d0s7 ): 1408858 blocks 284098 files

    /tmp (swap ): 2903968 blocks 10169 files

    /var/mail(mail:/mail ):14054672 blocks 1097254 files

    /var/spool/uucp (mail:/var/spool/uucp): 3450734 blocks 350809 files

    du display disk usage statistics (in number of 512k blocks)$ du | head -5

    282 ./zmodem

    14 ./gzip-0.7/msdos

    2 ./gzip-0.7/os2

    662 ./gzip-0.7

    du shows disk usage of

    directories in 512k blocks

  • 7/30/2019 sysadm

    7/12

    COMP111

    Lecture A2 / Slide 7

    User Accounts (1)

    Creating user accounts (root super-user only)useradd [-c comment] [-d home_dir]

    [-e expire_date] [-f inactive_time]

    [-g initial_group] [-G group[,...]]

    [-m [-k skeleton_dir] | -M] [-p passwd]

    [-s shell] [-u uid [ -o]] [-n] [-r] login

    useradd -D [-g default_group] [-b default_home]

    [-f default_inactive] [-e default_expire_date]

    [-s default_shell]

    $ su

    Password:$ useradd wujun

    Viewing user account settings$ ypcat passwd | grep wujun

    wujun:##wujun:30152:1501:Wu_Jun,,=EXP.2001.07.31=DEMTER=PC.yes=RMACCESS.yes:/homes/wujun:/bin/tcsh

    -D changing defaults

    su change to another user (default= root)

  • 7/30/2019 sysadm

    8/12

    COMP111

    Lecture A2 / Slide 8

    User Accounts (2)

    Changing password (user may change own password)$ passwd john

    Changing password for user john

    New UNIX password:

    BAD PASSWORD: it is based on a dictionary word

    Retype new UNIX password:passwd: all authentication tokens updated successfully

    Changing user account setting (super-user only)$ usermod

    usage: usermod [-u uid [-o]] [-g group] [-G group,...][-d home [-m]] [-s shell] [-c comment] [-l new_name]

    [-f inactive] [-e expire ] [-p passwd] [-L|-U] name

    $ usermod -p secret john

  • 7/30/2019 sysadm

    9/12

    COMP111

    Lecture A2 / Slide 9

    User Accounts (3)

    Deleting a user account

    userdel [ -r ] login

    The userdel utility deletes a user's login from the system

    and makes the appropriate login-related changes to the sys-tem file and file system.

    OPTIONS

    The following options are supported:

    -r Remove the user's home directory from the system.This directory must exist. The files and direc-

    tories under the home directory will no longer be

    accessible following successful execution of the

    command.

    $ userdel john

    COMP111

  • 7/30/2019 sysadm

    10/12

    COMP111

    Lecture A2 / Slide 10

    User Groups (1)

    Adding a new group (super-user only)$ groupadd

    usage: groupadd [-g gid [-o]] [-r] [-f] group

    $ groupadd comp111

    Adding users to a group (super-user only)

    $ usermod -G comp111 kwchiu

    $ usermod -G comp111 john

    COMP111

  • 7/30/2019 sysadm

    11/12

    COMP111

    Lecture A2 / Slide 11

    User Groups (2)

    View users of a group$ ypcat group | grep comp111

    comp111:*:40000:kwchiu,john

    usage: groupmod [-g gid [-o]] [-n name] group

    Renaming a group (super-user only)$ groupmod

    usage: groupmod [-g gid [-o]] [-n name] group

    $ groupmod -n cs111 comp111

    Deleting a group

    $ groupdel

    usage: groupdel group

    $ groupdel cs111

    COMP111

  • 7/30/2019 sysadm

    12/12

    COMP111

    Lecture A2 / Slide 12

    Shutdown

    An executable shell script that calls the init program to shutdown the system.Recommended for servers because users are notified of the impending shutdown as are the systems that are mounting resources from the server beingshut down.

    Usage: /usr/sbin/shutdown [ -y ] [ -g grace-period ]

    [-i init-state ] [ message ]

    $ shutdown -i S -g 120 "===== disk replacement ====="

    Shutdown started. Tue Jun 7 14:51:40 PDT 1994

    Broadcast Message from root (pts/1) on foo Tue Jun 7 14:51:41...

    The system will be shut down in 2 minutes

    ===== disk replacement =====

    Broadcast Message from root (pts/1) on foo Tue Jun 7 14:52:41...

    The system will be shut down in 1 minutes

    ===== disk replacement =====

    Broadcast Message from root (pts/1) on foo Tue Jun 7 14:53:41...

    The system will be shut down in 30 seconds

    ===== disk replacement =====

    Do you want to continue? (y or n):


Recommended