大一上合集课件系统管理system admin new class file_第1页
大一上合集课件系统管理system admin new class file_第2页
大一上合集课件系统管理system admin new class file_第3页
大一上合集课件系统管理system admin new class file_第4页
大一上合集课件系统管理system admin new class file_第5页
已阅读5页,还剩40页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、System AdminClass 2 - File System AdministrationBy Ian Robert Blair, M.S.Monday, October 7, 13AgendaVi Text EditorPermissions and ACLsFilesystem AdminMonday, October 7, 13VIM Text EditorMonday, October 7, 13dDescriptionvi fileOpen file in text Editorx, dw, ddDelete character, word, and liney, yyCopy

2、 word, lineppasteu, :redoundo and redoi, aInsert and appendo, OOpen a blank line below, above the current line:q!, :wq!Exit and Save then exit:helpget helpImportant Directories 1Monday, October 7, 13dDescription/The root directory, present in all Linux filesystem structures, is the ancestor of all f

3、iles in the filesystem/binEssentiald binaries and files needed to bring the system up and run it when it first comes up in single-user mode/bootContains all the files needed to boot the system/devContains all files that represent peripheral devices, such as disk drives, terminals, and printers/etcHo

4、lds administrative, configuration, and other system files/homeUser home directories/libShared libraries/lodulesLoadable kernel modules/mntMount point for temporarily mounting filesystems/optAdd-on (optional) software packages/procKernel and process information virtual filesystem/rootHome directory f

5、or the rootImportant Directories 2Monday, October 7, 13dDescription/tmpTemporary files/usrTraditionally includes subdirectories that contain information used by the system/usr/binContains the standard Linux utility programs/usr/includeHeader files included by C programs/usr/libLibraries/usr/localHol

6、ds locally important files and directories that a ded to the system. Subdirectories can include bin, games, include, lib, sbin, share, and src./usr/share/doc, info, manDocumentation, Info, man pages/usr/srcSource code/sbin, /usr/sbinUtilities used for system administration are stored in /sbin and /u

7、sr/ sbin. The /sbin directory includes utilities needed during the booting process, and /usr/sbin holds utilities used after the system is up and runningImportant Directories 3Monday, October 7, 13dDescription/varFiles with contents that vary as the system runs are kept in sub- directories under /va

8、r. The most common examples are temporary files, system log files, spooled files, and user mailbox files.Subdirectories can include cache, lib, lock, log, mail, opt, run, spool, tmp, and yp./var/logLog files/var/spoolSpooled application data, like anacron, at, cron, lpd, mail, mqueue, samba, and oth

9、er directoriesDirectorydsMonday, October 7, 13UsageDescriptionPopular OptionspwdShow the current working directorymkdir folder folder 2.Create one or more directories-p (create parents)cd pathChange the current working directory (home dir.), - (previous dir.)rmdir directoryRemove directorytouch file

10、Create and empty fileMonday, October 7, 13Permissions Three types of users can access a file: the owner of the file, a member of a group that the file is associated with, and others A user can attempt to access an ordinary file in three ways: by trying tofrom, write to, or execute it Execute permiss

11、ions for a directory allows a user to cd into that directory-rwxr-xr-x+ 1 sam pubs 2048 06-10 memoPermissiondsExamples:chmod o-rx check_spell chmod 600 letter.0210chmod 4755 myprog1 chmod o+r /home/max/infoMonday, October 7, 13UsageDescriptionPopular Optionschmod permission fileChange access permiss

12、ionsu, a, o, g, +, -, =, r, w, x, s or4 (), 2 (write), 1 (execute)setuidThe process executing the file takes on the privileges of the files owner4000setgidThe process executing the file the privileges of the group the file is associated with2000ACLsACLs (Access Control Lists) provide finer-grained c

13、ontrol over which userscan access specific directories and files than do traditional Linux permissionsAn ACL comprises a set of rules, that specify how a specific user or group can access the file that the ACL is associated withThere are two kinds of rules: access rules and default rulesMonday, Octo

14、ber 7, 13ACLs, cont.An access rule specifies access information for a single file or directoryA default ACL pertains to a directory only; it specifies default access information (an ACL) for any file in the directory that is not given an explicit ACL.To preserve ACLs use cp with -a or -p option, mos

15、t other utilities dont support ACLs (tar, cpio, dump, etc.)Monday, October 7, 13Enabling ACLsThe acl package must be installed before you can use ACLsFedora/RHEL ocially supports ACLs on ext2, ext3, and ext4 filesystems onlyTo use ACLs on an ext2/ext3/ext4 file-system, you must mount the device with

16、 the acl optionFirst, add acl to its options list in /etc/fstabThen, remount the filesystem mount -v -o remount /homeMonday, October 7, 13ACLdsExamples:setfacl -modify u:sam:rw- report or setfacl -modify u:sam:6 report setfacl -x u:sam reportsetfacl -d -m g:pubs:r-x,g:adm:rwx dirMonday, October 7, 1

17、3UsageDescriptionPopular OptionsgetfaclShow ACLssetfaclSet, modify, or delete ACLs-d (default) -x (remove)/-m (modify) ugo:name:permission filesLinksA link is a pointer to a fileA hard link is a pointer to a file (the directory entry points to the inode), whereas a symbolic or soft link is an indire

18、ct pointer to a file (the directory entry contains the pathname of the pointed-to filea pointer to the hard link to the file)rm removes a linkMonday, October 7, 13LinkdsExamples:ln draft /home/max/letterln -s /home/max/grades /tmp/grades.oldMonday, October 7, 13UsageDescriptionPopular OptionslnCreat

19、e links-sImportant Files/etc/passwd - users to the system/etc/group - file associates one or more usernames with each group (number)/etc/shadow - hashed user passwords, depending on system configurationMonday, October 7, 13More Important Files and Directories 2/etc/fstab - contains a list of mountab

20、le devices/etc/init - holds Upstart job definition files/etc/default - holds files that set default values for system services and utilities/etc/inittab - initialization table (ignored, except for run level)/etc/motd - Contains the message of the day, which can be displayed each time someone logs in

21、 using a textual loginMonday, October 7, 13More Important Files 3/etc/resolv.conf - provides access to DNS/etc/services - lists system services/etc/sysconfig - contains a hierarchy of system configuration filesMonday, October 7, 13Devices Device files include both block and character special files a

22、ndrepresent device drivers that allow the system to communicate with peripheral devices, such as terminals, printers, and hard disks Device files appear in the /dev directory and its subdirectories After running ls -l /dev, the first character of each line is always , b, c, d, l, or p, representing

23、the file typeordinary (plain), block, character, directory, symbolic link, or named pipe, respectivelyMonday, October 7, 13Popular File SystemsMonday, October 7, 13File SystemsDescriptionext2A standard linux filesystemext3A journaling extension to the ext2 filesystemext4An extension to the ext3; pro

24、vides improved performance over ext3 the filesystem.iso9660Standard filesystem for CDs and DVDsvfatDeveloped by Microsoft, a standard that allows long filenames on FAT partitionsreiserfsA journaling filesystem based on balanced-tree algorithmsxfsSGIs journaling filesystemMounting File SystemsThe mou

25、nt utility connects directory hierarchiestypically filesystemstothe Linux directory hierarchyThis directory, mount point, must exist before you can mount a filesystemIts contents disappear as long as a filesystem is mounted on it and reappear when you unmount the filesystemWithout any arguments, mou

26、nt lists the mounted filesystemsThe umount utility unmounts a filesystem as long as it does not contain any files or directories that are in use (open)Monday, October 7, 13Mount PointsMounting a filesystem associates the filesystem with a directory in thedirectory hierarchyA filesystem can be mounte

27、d on any directory (mount point) in the directory hierarchyFor example,the /dev/sda2 partition can be mounted on /home when thesystem boots allowing you to access it as the /home directoryOne filesystem does not aect other filesystemsOne filesystem on a drive might be corrupt and un filesystems func

28、tion normallyable, while otherMonday, October 7, 13Mount Points 2Monday, October 7, 13Mount PointDescription/ (root)Any directories you do not create filesystems for automatically become part of the root (/) filesystem(swap)Space for swapprograms out of RAM; Used when a system hibernates; minimum 1.

29、5x the size of RAM; Not mounted/bootHolds the kernel and other data the system needs when it boots; ext2/vardata in this partition changes frequently; holds the bulk of system logs, package information, anding data/homeuser home directoriesMonday, October 7, 13/etc/fstab# cat /etc/fstab./dev/mapper/

30、vg_bee-lv_root/ext4defaults1 1UUID=7694f86e-c3ff-4e51-b677-01b3d27927a4 /bootext4defaults1 2/dev/mapper/vg_bee-lv_swapswapswapdefaults0 0tmpfs/dev/shm tmpfsdefaults0 0devpts/dev/pts devpts gid=5,mode=620 0 0sysfs/syssysfsdefaults0 0proc/procprocdefaults0 0Monday, October 7, 13/etc/fstabName, label,

31、or UUID of a device# cat /etc/fstab./dev/mapper/vg_bee-lv_root/ext4defaults1 1UUID=7694f86e-c3ff-4e51-b677-01b3d27927a4 /bootext4defaults1 2/dev/mapper/vg_bee-lv_swapswapswapdefaults0 0tmpfs/dev/shm tmpfsdefaults0 0devpts/dev/pts devpts gid=5,mode=620 0 0sysfs/syssysfsdefaults0 0proc/procprocdefault

32、s0 0Monday, October 7, 13/etc/fstabMount point onName, label, orthe localUUID of a devicefilesystem# cat /etc/fstab./dev/mapper/vg_bee-lv_root/ext4defaults1 1UUID=7694f86e-c3ff-4e51-b677-01b3d27927a4 /bootext4defaults1 2/dev/mapper/vg_bee-lv_swapswapswapdefaults0 0tmpfs/dev/shm tmpfsdefaults0 0devpt

33、s/dev/pts devpts gid=5,mode=620 0 0sysfs/syssysfsdefaults0 0proc/procprocdefaults0 0Monday, October 7, 13/etc/fstabMount point onName, label, orthe localUUID of a devicefilesystem# cat /etc/fstab./dev/mapper/vg_bee-lv_root/ext4defaults1 1UUID=7694f86e-c3ff-4e51-b677-01b3d27927a4 /bootext4defaults1 2

34、/dev/mapper/vg_bee-lv_swapswapswapdefaults0 0tmpfs/dev/shm tmpfsdefaults0 0devpts/dev/pts devpts gid=5,mode=620 0 0sysfs/syssysfsdefaults0 0proc/procprocdefaults0 0Filesystem type (ex. ext4, ext2, nfs, iso9660, etc)Monday, October 7, 13/etc/fstabMount point oncomma separated listName, label, orthe l

35、ocalof options (defaults,UUID of a devicefilesystemro, rw, etc.)# cat /etc/fstab./dev/mapper/vg_bee-lv_root/ext4defaults1 1UUID=7694f86e-c3ff-4e51-b677-01b3d27927a4 /bootext4defaults1 2/dev/mapper/vg_bee-lv_swapswapswapdefaults0 0tmpfs/dev/shm tmpfsdefaults0 0devpts/dev/pts devpts gid=5,mode=620 0 0

36、sysfs/syssysfsdefaults0 0proc/procprocdefaults0 0Filesystem type (ex. ext4, ext2, nfs, iso9660, etc)Monday, October 7, 13/etc/fstabMount point oncomma separated listName, label, orthe localof options (defaults,UUID of a devicefilesystemro, rw, etc.)# cat /etc/fstab./dev/mapper/vg_bee-lv_root/ext4def

37、aults1 1UUID=7694f86e-c3ff-4e51-b677-01b3d27927a4 /bootext4defaults1 2/dev/mapper/vg_bee-lv_swapswapswapdefaults0 0tmpfs/dev/shm tmpfsdefaults0 0devpts/dev/pts devpts gid=5,mode=620 0 0sysfs/syssysfsdefaults0 0proc/procprocdefaults0 0Filesystem type (ex. ext4,Backup withext2, nfs, iso9660, etc)dump

38、utilityMonday, October 7, 13/etc/fstabMount point oncomma separated listName, label, orthe localof options (defaults,UUID of a devicefilesystemro, rw, etc.)# cat /etc/fstab./dev/mapper/vg_bee-lv_root/ext4defaults1 1UUID=7694f86e-c3ff-4e51-b677-01b3d27927a4 /bootext4defaults1 2/dev/mapper/vg_bee-lv_s

39、wapswapswapdefaults0 0tmpfs/dev/shm tmpfsdefaults0 0devpts/dev/pts devpts gid=5,mode=620 0 0sysfs/syssysfsdefaults0 0proc/procprocdefaults0 0Filesystem type (ex. ext4,Backup withfsck orderext2, nfs, iso9660, etc)dump utility(1,2,3 or 0 nocheck)FileSystemds# tune2fs -c 8 -i 15 /dev/sda1 # forces a fs

40、ck every 8 boots or 15 days, which ever occurs firstMonday, October 7, 13dDescriptionPopular Optionsmount /fs /mpMount a filesystem(fs) on a mount point (mp)-t (file system type)umount /mpRemove a mount file systemstune2fs filesystemDisplays and modifies filesystem parameters on ext2, ext3, and ext4

41、 filesystemsfsck filesystemVerifies the integrity of filesystems and, if possible, repairs problems it finds-A (check all file systems in fstab), -R (dont check root)Partitions 1A partition, or slice, is a logical sectionof a hard disk that has a device name, such as /dev/sda1A partition table holds

42、 information about the partitions on a hard diskBefore you can use a partition, afilesystem needs to be writtenA filesystem is data structure that holds inodes that map locations on the disk that store files to the names of the filesYou can use the mkfs utility to manually create a filesystem on a p

43、artitionMonday, October 7, 13Partitions 2A typical disk is divided into threeprimary partitions (1-3) and one extended partition (4)Once you establish the extended partition, you can subdivide it into additional logical partitions (numbered 5 or greater)You cannot use the extended partition (number

44、4)only the logical partitions it holds (5+)Monday, October 7, 13Disk ManagementThe parted (partition editor) utility reports on and manipulates hard diskpartitions from thed lineThe palimpsest utility allows you to perform the same tasks using a GUIparted /dev/sda print mklabel, mktable mkpartMonday

45、, October 7, 13Disk ManagementThe e2label utility displays or creates a volume label on an ext2, ext3, orext4 filesystem e2label device newlabelThe blkid utility displays labels, UUID value, and filesystem type for block devicesMonday, October 7, 13du/dfdf - Display overall disk utilization informat

46、ion for mounted filesystemson file df -hdu - Display disk utilization information for directoriesdu -sh /home/*Monday, October 7, 13Additional Utilities 2The lsof (list open files) utility displays the names of open files lsof -s -p pidThe stat utility displays information about a file or filesystem

47、 stat -f /dev/sdaThe lshw, lsusb, lspci utility (lshw package, Fedora only) lists system hardwareMonday, October 7, 13Monday, October 7, 13LVM, pt. 1 The Logical Volume Manager allows you to change the size of logical volumes on the fly With LVM, if you make a mistake in setting up LVs or if your needs change, you can make LVs either smaller or larger without aecting user dataDisk ADisk BDisk CDisk DPhys

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论