[ Pobierz całość w formacie PDF ]
.In addition, whenever you run a shell script, youautomatically start another instance of the shell to execute the script.The initialization files used bybashare: /etc/profile(set up by the system ad-ministrator and executed by all bash users at logintime), $HOME/.bash profile(executed by a login bash session), and $HOME/.bashrc (executed by all non-logininstances of bash).If.bash profileis not present,.profileis used in-stead.tcsh uses the following initialization scripts: /etc/csh.login (executed by alltcshusers atlogintime),$HOME/.tcshrc(executed at login time and by all new in-stances oftcsh), and$HOME/.login(executed atlogintime, following.tcshrc).If.tcshrcis not present,.cshrcis used instead.A complete guide to shell programming would be beyond the scope of this book.Seethe manual pages forbashortcshto learn more about customizing the Linux environ-ment.186 Linux Tutorial3.15 So you want to strike out on your own?This chapter should give you enough information for basic Linux use.The manualpages are indispensable tools for learning about Linux.They may appear confusing at first,but if you dig beneath the surface, there is a wealth of information.We also suggest that you read a general Linux reference book.Linux has more featuresthan first meet the eye.Unfortunately, many of them are beyond the scope of this book.Other recommended Linux books are listed in Appendix A.Chapter 4System AdministrationThis chapter covers the most important things that you need to know about system ad-ministration under Linux in sufficient detail to start using the system comfortably.In orderto keep the chapter manageable, it covers just the basics and omits many important details.The Linux System Administrator s Guide, by Lars Wirzenius (see Appendix A) providesconsiderably more detail on system administration topics.It will help you understand bet-ter how things work and hang together.At least, skim through the SAG so that you knowwhat it contains and what kind of help you can expect from it.4.1 Therootaccount.Linux differentiates between different users.What they can do to each other and thesystem is regulated.File permissions are arranged so that normal users can t delete ormodify files in directories like /binand/usr/bin.Most users protect their own fileswith the appropriate permissions so that other users can t access or modify them.(Onewouldn t want anybody to be able to read one s love letters.) Each user is given an accountthat includes a user name and home directory.In addition, there are special, system definedaccounts which have special privileges.The most important of these is the root account,which is used by the system administrator.By convention, the system administrator is theuser,root.There are no restrictions on root.He or she can read, modify, or delete any file onthe system, change permissions and ownerships on any file, and run special programs likethose which partition a hard drive or create file systems.The basic idea is that a person who187188 System Administrationcares for the system logs in asrootto perform tasks that cannot be executed as a normaluser.Because root can do anything, it is easy to make mistakes that have catastrophicconsequences.If a normal user tries inadvertently to delete all of the files in/etc, the system will notpermit him or her to do so.However, ifroottries to do the same thing, the system doesn tcomplain at all.It is very easy to trash a Linux system when usingroot.The best way toprevent accidents is:Sit on your hands before you press Enter for any command that is non-reversible.If you re about to clean out a directory, re-read the entire command to make sure thatit is correct.Use a different prompt for the root account.root s.bashrc or.login fileshould set the shell prompt to something different than the standard user prompt.Many people reserve the character # in prompts for root and use the promptcharacter $ for everyone else.Loginasrootonly when absolutely necessary.When you have finished your workas root, log out.The less you use the root account, the less likely you are todamage the system.You are less likely to confuse the privileges ofrootwith thoseof a normal user.Picture the root account as a special, magic hat that gives you lots of power, withwhich you can, by waving your hands, destroy entire cities.It is a good idea to be a bitcareful about what you do with your hands.Because it is easy to wave your hands ina destructive manner, it is not a good idea to wear the magic hat when it is not needed,despite the wonderful feeling.We ll talk in greater detail about the system administrator s responsibilities starting onpage 201.4.2 Booting the system.Some people boot Linux with a floppy diskette that contains a copy of the Linux kernel.This kernel has the Linux root partition coded into it, so it knows where to look for the rootfile system.This is the type of floppy created by Slackware during installation, for example.To create your own boot floppy, locate the kernel image on your hard disk.It should bein the file/vmlinuz, or/vmlinux.In some installations,/vmlinuzis a soft link tothe actual kernel, so you may need to track down the kernel by following the links.Booting the System 189Once you know where the kernel is, set the root device of the kernel image to the nameof your Linux root partition with therdevcommand.The format of the command isrdev kernel-name root-devicewhere kernel-name is the name of the kernel image, and root-device is the name of theLinux root partition.For example, to set the root device in the kernel /vmlinuz to/dev/hda2, use the command# rdev /vmlinuz /dev/hda2rdevcan set other options in the kernel, like the default SVGA mode to use at boot time.The command# rdev -hprints a help message on the screen [ Pobierz całość w formacie PDF ]