Unix Systems Administration

Introduction to systems Administration

To r00t or not to r00t

Unix security is (in most cases) binary. Either you are root or you are not.

Effects on permissions

Windows comparison with no users (win 3.x) to “kinds of users” i.e administrator(s) etc.

Group permissions in UNIX also available using /etc/group

Safety Regulations

Have a non root user for non privileged operations. (use pw useradd to add a user)

Use su when you need root.

Do NOT leave a root user logged in

Chose root password (as with any other password) particularly carefully.

(Other security considerations covered elsewhere)

Worksheet 1:

pw useradd -m <USERNAME>

passwd <USERNAME>

<ALT>+F<N> to switch terminals

Login with username and password created

su

Doesn't work – why?

Switch back to first terminal

Run pw usermod <USERNAME> -G wheel

Switch back to user terminal (ALT+F2)

Try su – still doesn't work.. why?

Type “id” to see what the system thinks of us

Log out and log in again

Type “id” again

Now try su

After you have done that, you can log out with “exit”

Filesystem

Recap: no drives on system – only one huge filesystem (set of directories and files).

Physical (or otherwise) devices are attached to the system with the “mount” command (read the man page)

To detach devices from the filesystem we use the “umount” command. (read the man page)

mount with no options lists the mounted systems.

Check UNIX handout for other filesystem commands.

Worsheet2

ls /cdrom (should be empty)

mount -r -t cd9660 /dev/acd0 /cdrom

ls /cdrom (should have contents of CD drive)

less /cdrom/README.txt (case sensitive)

'q' to quit

umount /cdrom to unmount (always do this before ejecting any removable media)

Package Management

Easy way to install, programes are precompiled – quick to manage.

Has a few problems:

Compiler optimisations absent

Optional features may not exist e.g. Database support.

FreeBSD is to pkg_* as RedHAT is to rpm ... almost.

pkg_info, pkg_add, pkg_delete etc (read man pages)

worksheet3

Mount your FreeBSD CD1 in your CDROM drive.

pkg_add /cdrom/packages/All/bash-2.05b.007_2.tbz

pkg_info -L bash\* (note the backslash is to escape the *)

All files under /usr/local

Type bash

Doesn't work? Why?

Rehash and try again.

Most common is vi only that it has lots of modes that are interesting.

[ESC] key to go to command mode from any mode

'i' key from command mode to start editing text

Refer to UNIX command reference

ee is also another common UNIX editor – not always avaiable on some systems (e.g in single user mode to be discussed later)

Commands are executed using the [CTRL]+<somekey>

Help screen displayed in editor

Editors

More Editors

Joe is what we will install shortly

Default settings are similar to ee

Can be set to behave like vi ...

Refer to handout

Others exist like Emacs

VERY powerfull and VERY complicated

We shall not install it during this workshop

Editor worksheet

vi /etc/rc.conf

Scroll down to bottom line.

Type i

ifconfig_sis0=”196.200.219.N/25”

default_router=”196.200.219.126”

Hit [ESC]

Type :wq!

Editor worksheet continued

vi /etc/resolv.conf

Add the lines...

search e0.ws.afnog.org

nameserver 196.200.222.2

nameserver 196.200.222.1

Type :wq (to write and quit)

Also possible to install packages over ftp..

pkg_add -v
ftp://noc.e0.ws.afnog.org/pub/FreeBSD/releases/i386/5.3-RELEASE/packages/
All/joe-2.8_5.tbz

Sometimes easier to use the ftp client....

ftp noc.e0.ws.afnog.org

(username ftp, password your e-mail)

cd /pub/FreeBSD/releases/i386/5.3-RELEASE/packages/All

get lynx-ssl-2.8.5.tbz

quit

pkg_add lynx-ssl*

/stand/sysinstall can also be used to install packages over different sources.

2005-04-17T11:05:44