Hands-On UNIX I ... not so gentle introduction Conventions # type - - PowerPoint PPT Presentation

hands on unix i
SMART_READER_LITE
LIVE PREVIEW

Hands-On UNIX I ... not so gentle introduction Conventions # type - - PowerPoint PPT Presentation

Hands-On UNIX I ... not so gentle introduction Conventions # type this as root on the command line (don't type the #) $ type this as an ordinary user (don't type the $) FreeBSD's installed. What next First time you login on your system


slide-1
SLIDE 1

Hands-On UNIX I

... not so gentle introduction

slide-2
SLIDE 2

Conventions

# type this as root on the command line

(don't type the #)

$ type this as an ordinary user (don't type the $)

slide-3
SLIDE 3

FreeBSD's installed. What next

  • First time you login on your system you are presented

with a prompt that looks something like:

FreeBSD/i386 (Amnesiac) (ttyv0) login:

  • Enter usename 'root' and the password we gave you in

class for the root account.

  • CTRL-ALT-FN for virtual terminals, FN is anything

from F1 to F8. By default you are in ttyv0 which corresponds to the CTRL-ALT-F1 keyboard sequence.

slide-4
SLIDE 4

Virtual Terminals ctd

  • Login and press:

CTRL-ALT-F2

and log in again.

  • Try typing in the command

# clear and pressing ENTER. Your screen clears and goes to the top. Now, you can easily recover your last command by pressing the UP-ARROW

slide-5
SLIDE 5

To r00t or not to r00t

  • Review UNIX security model

– uid – gid – 0 or anything else bypasses all security checks (well

except some)

  • When to use the root account, and when not to.
slide-6
SLIDE 6

Exercise 1: Users

slide-7
SLIDE 7

FileSystem: Tree Structure

slide-8
SLIDE 8

Exercise 2: Managing Files

slide-9
SLIDE 9

Exercise 3: Getting Help

slide-10
SLIDE 10

Permissions Revisited

  • Three sets of permissions, user, group and world
  • Three main permissions: read ( r ), write (w ), execute

(x)

  • Octal values for each:

– r = 4 – w = 2 – x = 1

  • ls -l will show the permissions, chmod will set them
slide-11
SLIDE 11

Using chmod

  • Octal set, specify the sum of octal permissions you

want to turn on for all permission sets e.g rwxr-x-- becomes (4+2+1)(4+1)(0) = 750... so the command becomes chmod 750 filename

  • Other way is to specify what set you want and what

permission you want to add or remove: u=user, g=group, o=other, a= all.

– chmod u+w filename (adds w permission to user set on

filename – leaves other bits untouched)

– chmod u=rx filename (explicitly sets user bits to r and x

irrespective of what they were)

– chmod u+w, g=rx filename (same thing for more than one

set of permissions)

slide-12
SLIDE 12

Exercise 4: Editing files with vi

slide-13
SLIDE 13

Why vi?

  • We teach vi because it's the most common and will be found on

almost all UNIX systems. It also happens to be pretty powerfull. Other editors are available, but may have to be installed as an additional step: i.e won't come installed by default. A good alternative is ee.

slide-14
SLIDE 14

Exercise 5: Editing Files with ee