[ Pobierz całość w formacie PDF ]
.If you don t like the default editor, you can first specify yourown temporarily as follows:# EDITOR=/usr/bin/pico;export EDITORThis will make the edquota command use the pico text editor.When edquota runs, you ll endup in your editor with the following text:Quotas for user cloobie:/dev/hda3: blocks in use: 58, limits (soft = 0, hard = 0)inodes in use: 41, limits (soft = 0, hard = 0)Although it is not important to understand all the information here (see Albert M.C.Tam smini-HOWTO, Quota, under the /usr/doc/HOWTO/mini for details), you can easily set boththe maximum number of files and the maximum size of your user s directory.To set limitsto 3 5MB for disk space, and between 500 and 1000 files, useQuotas for user cloobie:/dev/hda3: blocks in use: 58, limits (soft = 3000, hard = 5000)inodes in use: 41, limits (soft = 500, hard = 1000Save the file.Then, as a last step, you must set a grace period using edquota again, but thistime with the -t option.Your new user will be warned if the lower, or soft, limit is exceeded,for example:# edquota -t cloobieYou can then set the grace-period warnings for either exceeding the number of files or diskuse, for example:Time units may be: days, hours, minutes, or secondsGrace period before enforcing soft limits for users:/dev/hda3: block grace period: 1 days, file grace period: 1 daysIf you want to warn your user right away, use a grace period of one day (you can also useminutes or seconds).Finally, you can use the quota command to check the new quota, forexample:# quota cloobieDisk quotas for user cloobie (uid 502):Filesystem blocks quota limit grace files quota limit grace/dev/hda3 58 3000 5000 41 500 1000Using disk quotas may sometimes be necessary.If your disk space is at a premium, this couldbe one way to manage your hard drive resources.2 0Handling Files 313PARTVHour 21Handling FilesThis hour continues with the basics of system administration and introducesyou to handling files under Linux.You ll learn how to mount filesystems,manage the filesystem table (fstab), and format floppies.You ll see how you canprotect files and directories.You will use this knowledge to help you administer your Linux system.Knowing how to manage file ownership is an important Linux skill and canhelp you overcome problems later on.One great reason to get up to speed about file access and ownership has to dowith security.There are some important files in your Linux system that, as rootoperator, you don t want all users to have access to.If you ve set up your systemto handle dial-in calls, you ll want to make sure that important files, and evenother mounted filesystems, such as DOS or Windows, are protected.If youshare your computer, you normally wouldn t want other users to have access toyour files, but on the other hand, you might want to share files with otherpeople, but don t know how.2 1This hour starts with a discussion of the Linux file system.314 Hour 21There s a difference between a file system and a filesystem.A file system is the layout of thedirectories and hierarchy of files on a partition.A filesystem is the layout of the lower-levelformat of a storage device.Linux recognizes a number of filesystems.You can find a list inthe fstab, or filesystem table, manual page under the /usr/man/man5 directory, but it s bestto look at the current list of supported systems in the mount command manual page.Why?Because the mount command is used to mount the filesystem at a mount point, or a path youspecify.For now, take a look at the Linux file system.How Linux Is OrganizedThe software that comes with the Linux kernel is from a variety of different UNIX systems.Some programs, utilities, and commands, like mail or printing, come from a UNIXdistribution, called the Berkeley Software Distribution, or BSD.Other programs andmethods of organizing software, such as startup scripts and organization of files used duringstartup, come from either AT&T System V UNIX or later variants.Because of this mixedheritage, Linux has a mix of directories, and although most pundits say Linux leans towardsbeing System V-ish, you ll find elements of BSD and System V.To give you a better idea, Listin 21.1 contains an edited directory listing, courtesy of the treecommand.Listing 21.1.The basic Linux file system, or directory tree./ - the root directory|-- bin - programs considered necessary|-- boot - Linux boot image|-- dev - devices, like serial ports, printers, hard drives|-- etc - configuration files for network, X11, mail, etc.|-- home - where users live (including sysadmin)|-- lib - software libraries|-- lost+found - recovered files (from e2fsck)|-- mnt - where you mount other filesystems| |-- cdrom| |-- dos| |-- flash| ´-- floppy|-- proc - kernel, device, process status files|-- root - where the sysadmin works, but doesn t live|-- sbin - system binaries (many root-only)|-- tmp - temp files stored, deleted from here|-- usr - hosts much, much software, libraries| |-- X11R6 - X Window System software| |-- bin - more software| |-- dict - dictionaries| |-- doc - FAQs, HOW-TOs, software documentation| |-- etc - software configuration files2 1Handling Files 315| |-- games - fun, fun, fun!| |-- i486-linuxaout| |-- include - header files for programming| |-- info - GNU information| |-- lib - more software libraries| |-- libexec| |-- local - programs not on CD-ROM| | |-- bin| | |-- doc| | |-- etc| | |-- games| | |-- info| | |-- lib| | |-- man| | |-- sbin| | ´-- src - source code to programs| |-- man - manual pages| | |-- man1.9n| |-- sbin| |-- share| |-- src - source for Linux!!!| | |-- linux -> linux-2.30| | |-- linux-2.30| ´-- tmp ->./var/tmp´-- var - system logs, compressed manual pagesAs you can see, the main directory structure is not that complicated.What is important tounderstand here is that you should know where you are as you navigate the file system.Whenyou install software, especially without the benefit of using Red Hat s rpm package-management command (which you ll learn about in Hour 22, Red Hat Tools ), you shouldknow where different software should reside on your system.Many programs will also requiredifferent software components to be installed in different parts of the directory.If you look at the file system listing, you ll see a /mnt, or mount, directory.Although you don thave to use this directory as a gateway to other filesystems, this is traditionally where othersystems are mounted.The next section discusses how to have these other systems appearunder the mount directory.Using the mount Command to AccessOther FilesystemsThemount command, found under the /bin directory, is an essential program used not onlyby sysadmins, but also by Linux during startup and shutdown.This command is used to2 1mount filesystems and make them available in the directory tree.During startup, the primaryLinux partition, an ext2 filesystem, is mounted at the root filesystem, or /, directory
[ Pobierz całość w formacie PDF ]