lecture
in color
ci
co
rcs
rlog
rcsdiff
% mkdir RCSThis is a directory to hold revisions. This should be at the level of the file you are working on, say
foo.
% ci foo"Check in" the current contents of
foo as a revision. You will be asked to comment on the revision.
Revisions of foo are stored in the file RCS/foo,v. foo is deleted by this command. Don't feel bad, just check it out as noted below.
% co foo"Check out" the most current copy of
foo from RCS/foo,v. This is a read-only version that you can compile but can't edit.
% co -l fooThis command locks the file so that only you can check it back in. You should edit it and then check it in so that others may edit it as well. To check it back in use the
ci command.
% ci -l fooThis checks in the file and keeps it locked to you.
% rcs -u fooThis unlocks the file, sending mail to the offender who locked it.
% co -l fooThis checks the file out so you can edit it.
% rlog fooMake a listing of all revisions in
RCS/foo,v. This includes all comments given during updating.
% co -r2.3 foo
Check out revision 2.3 of foo from RCS/foo,v. Revision numbers are given in the output of rlog.
% rcs -l fooLock the current revision of foo.
% chmod u+w fooMake foo editable.
% ci fooMake the former revision the current one.
% rcsdiff -r1.2 foo | more
diff to compute differences.
diff -e and sed
-c: create a "context diff" showing how changes fit in context.
file1 contains
This is a test. This is another test. This is a third test. This is a fourth test.and
file2 contains This is a test. This is another test. This is a dumb test. This is a fourth test. This is a fifth test.then
diff -c file1 file2produces
*** file1 Tue Feb 29 14:28:06 2000 --- file2 Tue Feb 29 14:28:19 2000 *************** *** 1,4 **** This is a test. This is another test. ! This is a third test. This is a fourth test. --- 1,5 ---- This is a test. This is another test. ! This is a dumb test. This is a fourth test. + This is a fifth test.
-e: create a script of sed commands that'll change one file into another!
sed to change one file+ the diffs into the other!
diff -e file1 file2produces:
4a This is a fifth test. . 3c This is a dumb test. .
diff -e file1 file2 >diffs sed -f diffs <file1 >file3then
file2 and file3 will be the same.
v1, v2, v3, v4 are versions of a file and
dij is the output diff -e vi vjv4, d43, d32, and d21sed commands.
sed -f d43 <v4 | sed -f d32 | sed -f d21outputs the original version
v1!
patch: applies changes sent in an email message to a large
hierarchy of files.
diff -r -c old new >patch01
patch01 to you (or places it on the Internet)
cd old patch -p 1 <patch01
cvs checkout <module>makes a private copy of the module for you to edit. cd there and then:
cvs updategets new changes from others.
cvs add fileadds a new file to the module in your private working tree.
cvs remove fileremoves a file from the module in your private working tree.
cvs commit filecopies a file from your private working tree to the master tree.
rdist, cfengine)tripwire and aide)
/ or /usr.
/local/bin as list of commands to be put in
users' paths.
/local/bin, always use
symlinks to disjoint packages.
/local,
in /loc/slink/slink.conf. /loc).allegro:/local/bin, /loc/slink/slink.conf for details.
allegro:/loc/slink/slink.mod for the modification
policies for EECS.
/usr/local
/usr/local
/local
link /loc/fool/bin binlinks stuff into /bin in the root partition!
/interleaf on every host)/local/bin: normal user commands
/local/old/bin: old (deprecated) commands
/local/new/bin: new (untested) commands
/local/new/bin,
/local/bin,
/local/old/bin,
/local/old/bin.
/local/old/bin.
if no one complains, delete it.
initial
/loc/adm/foo1.0/bin/foo -------> /local/new/bin
tested
-------> /local/bin
replaced
-------> /local/old/bin
# - : ignore the following atributes # + : do not ignore the following attributes # # p : permission and file mode bits a: access timestamp # i : inode number m: modification timestamp # n : number of links (ref count) c: inode creation timestamp # u : user id of owner 1: signature 1 # g : group id of owner 2: signature 2 # s : size of file
/etc +pinugsm12-ameans to pay attention to everything but access timestamp for files in
/etc.
!/tmpdon't do anything with
/tmp=/usr Rcheck the directory
/usr, but not subdirectories.
# Templates: (default) R : [R]ead-only (+pinugsm12-a) # L : [L]og file (+pinug-sam12) # N : ignore [N]othing (+pinusgsamc12) # E : ignore [E]verything (-pinusgsamc12)
# root's files =/ L /.rhosts R # may not exist /.profile R # may not exist /.cshrc R # may not exist /.login R # may not exist /.logout R # may not exist /.forward R # may not exist /.netrc R # may not exist # devices /dev L /devices L =/devices/pseudo L # system databases /etc R /etc/default R /etc/dfs/dfstab R /etc/dfs/sharetab R /etc/dumpdates L /etc/group R # changes should be infrequent /etc/hosts.equiv R /etc/inet/inetd.conf R /etc/inet/protocols R /etc/inet/services R /etc/init.d R /etc/motd L /etc/opt R /etc/passwd L /etc/profile R /etc/remote R /etc/rmtab L /etc/rpc R =/etc/saf L /etc/shadow L /etc/system R /etc/ttydefs L /etc/ttysrch R # other sensitive directories /hsfsboot R /kernel R /opt R /sbin R /ufsboot R /usr/sbin R =/var L =/var/adm L /var/adm/utmp L /var/adm/wtmp L /var/adm/wtmpx L /var/adm/sulog L =/var/adm/sa L =/var/spool L # Checksumming the following is not so critical. However, # setuid/setgid files are special-cased further down. =/usr L /usr/aset R-2 /usr/bin R-2 /usr/ccs R-2 /usr/kernel R-2 /usr/lib R-2 /usr/ucb R-2 /usr/openwin/bin R-2 # temporary filesystems =/tmp L =/var/tmp L =/proc L # set-user-id files must be checksummed /usr/bin/at R /usr/bin/atq R /usr/bin/atrm R /usr/bin/chkey R /usr/bin/crontab R /usr/bin/ct R /usr/bin/cu R /usr/bin/eject R /usr/bin/login R /usr/bin/mail R /usr/bin/mailx R /usr/bin/netstat R /usr/bin/newgrp R /usr/bin/nfsstat R /usr/bin/passwd R /usr/bin/ps R /usr/bin/rcp R /usr/bin/rsh R /usr/bin/rdist R /usr/bin/rlogin R /usr/bin/su R /usr/bin/tip R /usr/bin/uucp R /usr/bin/uuglist R /usr/bin/uuname R /usr/bin/uustat R /usr/bin/uux R /usr/bin/volcheck R /usr/bin/w R /usr/bin/write R /usr/bin/yppasswd R /usr/ucb/ps R
tripwire -initialize
tripwire
/dev/sad/user 9 001..W 120777 16030 1 0 1 31 0unNQn 0qY.u9 0qY.u9 0 0 0 0 0 0 00 0 0
/dev/sad/admin 9 001..W 120777 16031 1 0 1 32 0unNQn 0qY.u9 0qY.u9 0 0 0 0 0 0 00 0 0
/dev/dsk 9 001..W 40775 23617 2 0 3 512 0unNR9 0taoXQ 0taoXQ 0 0 0 0 0 0 0 0 0 0
/dev/dsk/c1t0d0s0 9 001..W 120777 24010 1 0 0 74 0unNQn 0taoXP 0taoXP 0 0 0 0 00 0 0 0 0
tripwire gametripwire is a commercial product.
Aide is its freeware counterpart.
| Tripwire | Aide |
|---|---|
=/etc: just /etc |
=/etc$: match the regular expression /etc$ |
pinugsbmac |
p+i+n+u+g+s+b+m+a+c |
R,L,E |
R,L,E |
| no growing size check | S: growing logfile |
1,2: installed checksums |
md5,sha1,rmd160,tiger: checksums by name |
R).
L).
!).
lecture
in color