[ Pobierz całość w formacie PDF ]
.Shell changed.You can also use the chsh command to specify a program, other than a shell, to use as theprogram run when the user logs in, for example:# chsh -s /usr/bin/pico cloobieChanging shell for cloobie.Warning:  /usr/bin/pico is not listed as a valid shell.Shell changed.The chsh program will complain if the program is not listed as a shell in the /etc/shells file.Then check to see if the change was made:# cat /etc/passwd.cloobie:9Qa4.uFMhmInA:502:502:Mr.Cloobie Doo,400 Pennsylvania Ave.,202-555-1212,202-555-4000,:/home/cloobie:/usr/bin/picoThe preceding example specified the text editor pico, which would allow a user to do wordprocessing, printing, or spell-checking of documents, but that s all! As soon as the user logsinto Linux, the user is right in the text editor.After quitting the text editor, the user is loggedout.This is a handy technique you can use to restrict users, especially children, if you onlywant them to play a game.2 0 Basic System Administration 311There are other restrictions you can put in place.The next section shows you how you canlimit how much of your system s hard drive can be used.Setting Disk QuotasOn large, multiuser systems, disk quotas are not only a way of life, but a necessity.You canimpose disk quotas on your Linux system, and you should, especially if you worry about yourdisk space, or if you re afraid the users will create huge files and overrun your hard drive.Youcan also use disk quotas as a warning device (and maybe justification for a new hard drive?).This section explains how to start, set, and stop disk quotas.Quota Manipulation with the quota, quotaon, andquotaoff CommandsDisk quotas limit the amount of hard drive space in several ways.You can set quotas for agroup of users, by using the GID, or impose limits on individual users.To manage diskquotas, you ll use some or all of these commands:quota To report on disk quotasquotaon To turn on and set disk quotas for usersquotaoff To turn off disk quotas for usersrepquot Also reports on quotasedquota Edits user quotasquotacheck Checks filesystem on quota usageThis book won t go into all the details of these programs (read the manual pages), but thissection shows you how to set a disk quota for the new user you created.The first thing youmust do is to enable quotas for your Linux filesystem.This involves editing the filesystemtable, fstab, in the /etc/ directory.Be careful! You must make sure you don t make any otherchanges, or you could cause boot problems.You have been warned!Make sure you re logged in as root, then use your favorite text editor to open the fstab file,and edit the line containing the entry for your Linux partition, for example:2 0#/dev/hda3 / ext2 defaults 1 1Now add a command and the word usrquota to the word default, for example:/dev/hda3 / ext2 defaults,usrquota 1 1Save the /etc/fstab file.Next, use the touch command to create a file called quota.user, andmake the file read-write enabled, for example:# touch /quota.user# chmod 600 /quota.user 312 Hour 20After you have done this, reboot your computer by using the shutdown command with the-r, or restart, option.Log back in as root, and use the edquota command, found under the/usr/sbin directory, along with the -u option, to edit quotas for your new user, for example:# edquota -u cloobieThe edquota command will read in the user.quota file under your root, or /, directory.Thisfile is normally a binary file, but edquota will open the file using the text editor defined in yourEDITOR environment variable.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 0 Handling 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 [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • szamanka888.keep.pl